![]() |
| ||
| wxPython Error When I run this code: import wx I get some error about expecting a callable object for self.Bind()? Can someone tell me why this is happening? |
| ||
| Re: wxPython Error Theres ya problem! You dont need to put the brackets after self.Close, the brackets are only used if you actually want to call the function, so take out those brackets and try again. That hopefully should fix your dilemma. :) |
| ||
| Re: wxPython Error If paulthom12345's suggestion does not fix your problem, try to bind this way: import wx |
| ||
| Re: wxPython Error Forgot to mention this, but I also corrected line 10 to: self.fileMenu.Append(ID_FILE_QUIT, '&Quit\tCtrl+Q') |
| ||
| Re: wxPython Error Thanks guys, it turns out that I had to only put the function name, not call the function. :) |
| ||
| Re: wxPython Error Quote:
|
| ||
| Re: wxPython Error Quote:
|
| ||
| Re: wxPython Error Quote:
File "c:\Users\Elijah Ministries\Desktop\daniweb.py", line 17, in <module> frame = MainFrame('Ya Mum') File "c:\Users\Elijah Ministries\Desktop\daniweb.py", line 11, in __init__ self.Bind(wx.EVT_MENU, self.Close(), id=ID_FILE_QUIT) File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3911, in Bind event.Bind(self, id, id2, handler) File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3985, in Bind target.Connect(id1, id2, et, function) File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 3868, in Connect return _core_.EvtHandler_Connect(*args, **kwargs) |
| ||
| Re: wxPython Error I wonder how it runs on you! What version of wxPython do you have? |
| ||
| Re: wxPython Error If you were to take the most updated code, you'd see that it works. This is what Lardmeister posted: import wxWhich tom tetlaw acknowledged as he said "all I need to do is put the function name, not call the function". This is what we're doing by binding the function self.quit, rather than self.quit(). |
| All times are GMT -4. The time now is 12:58 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC