Josiah Carlson wrote:
As the subject says.
To reproduce:
Edit the demo/GridSimple.py
Rewrite the OnCellRightClick method:
def OnCellRightClick(self, evt):
self.log.write("OnCellRightClick: (%d,%d) %s\n" %
(evt.GetRow(), evt.GetCol(), evt.GetPosition()))
evt.Skip()
def foo(*args):
print "foo called!"
menu = wx.Menu()
id = wx.NewId()
it = wx.MenuItem(menu, id, 'Test')
self.Bind(wx.EVT_MENU, foo, it)
self.PopupMenu(menu)
self.log.write("Popped up menu!\n")
menu.Destroy()Run the "Core Windows/Controls" -> Grid demo, and click on the "Simple
wx.Grid, catching all events" button. Pick any cell, right-click. On
Windows, Python 2.3.5, wxPython 2.6.3.2 ansi, the grid doesn't pop up a
menu, but prints the "Popped up menu!" message instantly. I get the
same behavior on Ubuntu 6.06, Python 2.4.3, wxPython 2.6.3.3 unicode.
You need to do the following:
1. sit down
2. take a deep breath... and another...
3. add "menu.AppendItem(it)" to the code above
4. run the sample
5. bash your forehead on the desk in shame
6.
(Apparently PopupMenu saves you from yourself and returns immediately if the menu is empty.)
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!