Hi, i'm working on simple fullscreen launcher application, to use it with remote on my HTPC media center to launch xbmc, stepmania, nes emulator, etc
I'd like to use png icons with transparency, but there is a problem. In alpha channel of loaded icons i can see the back frame's color instead of PNG image loaded as wallpaper. What's wrong and how to solve that problem?
Here's the code i've wrote so far:
try:
import Tkinter as tk
except ImportError:
raise ImportError,"The Tcl/Tk is required to run this program."
try:
from PIL import Image, ImageTk
except ImportError:
raise ImportError,"Please install image module from http://www.pythonware.com/products/pil/"
class SimpleLauncher(tk.Tk):
def __init__(self, parent):
tk.Tk.__init__(self,parent)
self.parent = parent
self.width = self.winfo_screenwidth()
self.height = self.winfo_screenheight()
self.initialize()
def initialize(self):
backgroundFile = "night.png"
bckImage = Image.open(backgroundFile)
bckImage = bckImage.resize((self.width, self.height), resample=3)
background = ImageTk.PhotoImage(bckImage)
obrazek = ImageTk.PhotoImage(Image.open("ff.png"))
bckPanel = tk.Label(self, image=background)
bckPanel.pack(side='top', fill='both', expand='yes')
bckPanel.image = background
ikona = tk.Label(bckPanel, image=obrazek)
ikona.pack()
ikona.image = obrazek
bClose = tk.Button(bckPanel, text = u"EXIT", command = self.buttonClicked)
bClose.pack(pady=10, ipady=10)
bClose2 = tk.Button(bckPanel, text = u"EXIT2", command = self.buttonClicked)
bClose2.pack(pady=10, ipady=10)
def buttonClicked(self):
self.destroy()
def main():
app = SimpleLauncher(None)
app.overrideredirect(1)
w, h = app.winfo_screenwidth(), app.winfo_screenheight()
app.geometry("%dx%d+0+0" % (w, h))
app.mainloop()
if __name__ == "__main__":
main()
Using Python 2.6.4 (r264:75706, Jan 25 2010, 08:55:26) on Arch Linux
PIL 1.17
and unpleasant effect: