Newbie Tkinter Problem
Colleen & Brian Smith
greybria at direct.ca
Sat Dec 25 22:48:46 EST 1999
In the script below, when I hard-code the file name, the button works fine.
However, when I use the askopenfilename dialog, something is preventing the
button from working normally. If somebody could
point out where I'm going wrong, I'd sure appreciate it.
--------------------------------------
from Tkinter import *
import Image, ImageTk
from viewer import UI
from tkFileDialog import *
class Application(Frame):
def createWidgets(self):
self.QUIT = Button(self)
self.QUIT["text"] = "QUIT"
self.QUIT["fg"] = "red"
self.QUIT["command"] = self.quit
self.QUIT.pack(side=LEFT)
def LoadPic(self):
self.picname=askopenfilename(filetypes=[("JPEG", "*.jpg")])
self.pic = Image.open(self.picname)
self.pic.thumbnail((128, 128))
self.display = UI(self,self.pic)
self.display.pack(side=RIGHT)
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
self.LoadPic()
self.pack()
app = Application()
app.mainloop()
--
Colleen & Brian Smith
greybria at direct.ca
http://mypage.direct.ca/g/greybria
More information about the Python-list
mailing list