All,
Here is a situation I find myself in frequently. The code throws no errors, but
the GUI won't open.
import wx
class MenuExample(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(250, 200))
# this creates the menubar
menubar = wx.MenuBar()
# this creates main 'file' menu
file = wx.Menu()
# add an 'Open' submenu to 'file' menu
open = wx.MenuItem(file, 1, '&Open\tCtrl+O')
file.AppendItem(open)
# add a 'Quit' submenu to 'file' menu
quit = wx.MenuItem(file, 2, '&Quit\tCtrl+Q')
file.AppendItem(quit)
self.Bind(wx.EVT_MENU, self.onQuit, 2)
# this adds the 'file' menu to the menubar
menubar.Append(file, '&File')
# this adds the menubar to the frame
self.SetMenuBar(menubar)
# center and show the frame
self.Centre()
self.Show()
def onQuit(self,event):
self.Close()
app = wx.App()
MenuExample(None, -1, 'Menu Example')
app.MainLoop()
I found the error. I should have: self.Bind(wx.EVT_MENU, self.onQuit,
id=2)
However, I am wondering if there is anything I can do with the PyDev debugger
(or other strategy) to help locate this type of error when it happens. It is
very frustrating when no errors are returned but the GUI won't run.
David.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Pydev-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-users