Oops,

That should have been,


class MyApp:
        def __init__(self, parent):
                self.myParent = parent
                self.myContainer1 = Frame(parent)
                self.myContainer1.pack()

                self.entry = Entry(self.myContainer1)
                self.entry.grid(row=0,column=0, columnspan=2)
                self.button1 = Button(self.myContainer1,
                         command=(lambda: self.button1Click()))
                self.button1.configure(text="...")
                self.button1.grid(row=0, column=2)
                self.button1.bind("<Return>", self.button1Click)

        def button1Click(self, event=None):
                filePick = tkFileDialog.askopenfilename()


On Thursday 12 May 2005 03:43 pm, [EMAIL PROTECTED] wrote:
> I am creating a very simple GUI with one Entry widget and
> one Button.  The purpose of the Button widget is to Browse for
> a file using tkFileDialog.askopenfilename().
>
> I bind the button to a handler which spawns a tkFileDialog. This
> works but the button __stays depressed__ after the handler returns!
> Any ideas why?
>
> class MyApp:
>       def __init__(self, parent):
>               self.myParent = parent
>               self.myContainer1 = Frame(parent)
>               self.myContainer1.pack()
>
>               self.entry = Entry(self.myContainer1)
>               self.entry.grid(row=0,column=0 columnspan=2)
>
>               self.button1 = Button(self.myContainer1)
>               self.button1.configure(text="...")
>               self.button1.grid(row=0, column=2)
>               self.button1.bind("<Button-1>", self.button1Click)
>               self.button1.bind("<Return>", self.button1Click)
>
>
>       def button1Click(self, event):
>               filePick = tkFileDialog.askopenfilename()

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to