[Tutor] [wxPython-users] How to save file name of file openedfromwx.FileDialog ?

Alan Gauld alan.gauld at btinternet.com
Sun Nov 18 10:03:15 CET 2007

"Varsha Purohit" <varsha.purohit at gmail.com> wrote

I note that you got it wotking but just to clarify...

>    I am actually calling the binding function and then writing it
> into the text value... 

> class ScrolledWindow(wx.Frame):
>    def __init__(self, parent, id, title):
>        txt1 = wx.TextCtrl(panel, -1, pos=(30, 100), size=(150, 20))
>        name = self.Bind(wx.EVT_BUTTON, self.OnOpen, button11)
>        txt1.write(name)

The Bind function does not execute the handler method 
it simply registers it within wxPython for future use when 
the button event is triggered. The return value from Bind 
is not the return value of the method being bound.

The method only gets called when the button is pressed, 
thats why you have to put the write() call in the event 
handler itself.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list