Tkinter bug ?

Stephane Conversy conversy at lri.fr
Mon Jul 26 12:40:04 EDT 1999


File1.py:

from Tkinter import *

photo=None

def create_photo():
    global photo
    photo=PhotoImage(image="img.gif")



File2.py:

from Tkinter import *
from File1 import *

root = Tk()
create_photo()
b= Button(root, image=photo)
b.pack()
root.mainloop()


when executing File2.py, there is no error, but no image appears in the
button.

now if you chanage File2.py:

from Tkinter import *
import File1

root = Tk()
File1.create_photo()
b= Button(root, image=File1.photo)
b.pack()
root.mainloop()

it work fine. It seems to be a bug, isn't it ?

--
Stéphane Conversy
http://www-ihm.lri.fr/~conversy/
mailto:conversy at lri.fr







More information about the Python-list mailing list