By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,173 Members | 796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,173 IT Pros & Developers. It's quick & easy.

image transparency using Tkinter

P: 3
hi to all...
i'm working on an animation where i have to make the picture background.gif transparent.
l'm not able to do it.can you please help me or tell me what codes i should add to make the picture transparent.
thank in advance


Expand|Select|Wrap|Line Numbers
  1. import Tkinter
  2. from Tkconstants import *
  3. def window(tk):
  4.  
  5.     global photo       
  6.  
  7.     frame=Tkinter.Frame(tk)
  8.  
  9.     frame.pack()
  10.  
  11.  
  12.  
  13.     canvas=Tkinter.Canvas(frame,bg ='white', width=500,height=500)
  14.  
  15.     canvas.pack()
  16.  
  17.  
  18.  
  19.     photo=Tkinter.PhotoImage(file="background.gif")
  20.     canvas.create_image(200, 250, image=photo)
  21.  
  22.  
  23.  
  24.  
  25. root = Tkinter.Tk()
  26.  
  27. root.title("Simulation of infectious diseases")
  28.  
  29. window(root)
  30.  
  31. root.mainloop()
Nov 6 '07 #1
Share this Question
Share on Google+
1 Reply


bartonc
Expert 5K+
P: 6,596
So far, so good. Now, in order to work with images, you'll want to learn about the Python Image Library. You can get PIL at PythonWare.

Have fun.
Nov 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.