hi...i'm tryiing to make the picture gold.gif transparent so that i can make some animation on it.cn you please help me to make the picture transparent.thanks in advance


import Tkinter
from Tkconstants import *
import tkMessageBox

def window(tk):
global photo #### SIC!
frame=Tkinter.Frame(tk)
frame.pack()

canvas=Tkinter.Canvas(frame,bg ='white', width=500,height=500)
canvas.pack()

photo=Tkinter.PhotoImage(file="gold.gif")
canvas.create_image(200, 250, image=photo)
button1=Tkinter.Button(frame,fg="blue", text="GENERATE", activebackground='red').pack(padx =50,side = LEFT, pady =15)
button=Tkinter.Button(frame, fg ="blue",text="EXIT",activebackground='red',command=quitbutton).pack(side =LEFT, padx=20)


def quitbutton():
if tkMessageBox.askyesno("Quit", "Do you really wish to quit?"):
root.destroy()

root = Tkinter.Tk()
root.title("gold")
window(root)
root.mainloop()

Recommended Answers

All 4 Replies

thanx but its not reply helping me.can get the pyhton code where i can make the background transparent.plzzzzzzzzzzzzzzzzzzzz

Er, you misunderstand. We think it is the GIF that is faulty, not your code.

Again, I would suggest using an existing and tested tool, such as imagemagick called by os.system or subprocess to convert.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.