H
Harlin Seritt
Why is that I can only get the PhotoImage class to show up when I write
a straight procedural script (no object orientation) but not when I try
to use object-orientation?
These two scripts in theory should produce the same results but they
don't. Is there any reason why?
---Procedural---
root = Tk()
im = Image.open('image.gif')
photo = ImageTk.PhotoImage(im)
label = Label(image=photo)
label.pack()
root.mainloop()
---Object-Oriented---
from Tkinter import *
import Image, ImageTk
class App:
def __init__(self, master):
im = Image.open('dellserver.gif')
photo = ImageTk.PhotoImage(im)
label = Label(master, image=photo)
label.pack()
if __name__ == '__main__':
root = Tk()
app = App(root)
root.mainloop()
---END of CODE---
Thanks,
Harlin Seritt
a straight procedural script (no object orientation) but not when I try
to use object-orientation?
These two scripts in theory should produce the same results but they
don't. Is there any reason why?
---Procedural---
root = Tk()
im = Image.open('image.gif')
photo = ImageTk.PhotoImage(im)
label = Label(image=photo)
label.pack()
root.mainloop()
---Object-Oriented---
from Tkinter import *
import Image, ImageTk
class App:
def __init__(self, master):
im = Image.open('dellserver.gif')
photo = ImageTk.PhotoImage(im)
label = Label(master, image=photo)
label.pack()
if __name__ == '__main__':
root = Tk()
app = App(root)
root.mainloop()
---END of CODE---
Thanks,
Harlin Seritt