Strange problem with FileBrowseButtonWithHistory
I have encounter a strange problem with FileBrowseButtonWithHistory in combination with wxRadioButtons. The attached self-explanatory program is a small wxPython application for demonstrating the problem. Is this a bug in my application or wxPython?
I have used FileBrowseButtonWithHistory before but this problem occured when I added wxRadioButtons to the app.
(I’m using python2.2.2 & wxpython2.3.3.1 on win2k/winxp)
Thanks for any help!
Jens
wxPython newbee
from wxPython.wx import *
from wxPython.lib.filebrowsebutton import FileBrowseButtonWithHistory
class MainFrame(wxFrame):
ID_METHOD_REL = wxNewId()
ID_METHOD_ABS = wxNewId()
def __init__(self):
wxFrame.__init__(self,NULL,-1,"bug demo")
self.panel = wxPanel(self,-1)
meth1 = wxRadioButton( self.panel, self.ID_METHOD_REL, "rel" )
meth2 = wxRadioButton( self.panel, self.ID_METHOD_ABS, "abs" )
buggy = raw_input('Do you want to freeze the app when touching the radio buttons? (y/n): ')
if buggy=='y':
file = FileBrowseButtonWithHistory(self.panel, -1, changeCallback=self.getFile)
else:
file = wxTextCtrl( self.panel, -1, "dummy.dat" )
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add( file, 0, wxEXPAND )
sizer.Add( meth1, 0, wxEXPAND )
sizer.Add( meth2, 0, wxEXPAND )
self.panel.SetAutoLayout(true)
self.panel.SetSizer(sizer)
self.panel.Layout()
# Tie button clicks to some event handlers
EVT_RADIOBUTTON( self, self.ID_METHOD_REL, self.getMethodRel )
EVT_RADIOBUTTON( self, self.ID_METHOD_ABS, self.getMethodAbs )
def getFile(self, event):
print "File evt: ", event.GetString()
def getMethodRel(self, event):
print "hi rel"
def getMethodAbs(self, event):
print "hi abs"
class MyApp(wxApp):
def OnInit(self):
frame = MainFrame()
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
`
···
Neither the confidentiality nor the integrity of this message
can be guaranteed following transmission on the Internet.
This message has been swept by MAILsweeper at DNV for
the presence of computer viruses.
`