projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prevent disappearing menus in tabmdi
[wxWidgets.git]
/
wxPython
/
demo
/
PopupMenu.py
diff --git
a/wxPython/demo/PopupMenu.py
b/wxPython/demo/PopupMenu.py
index 9dd5435b2d52a734cc7cf51b69ffcb3cdc590923..837e9c27d46305bf4885cf9bc8d214f4ee5703e2 100644
(file)
--- a/
wxPython/demo/PopupMenu.py
+++ b/
wxPython/demo/PopupMenu.py
@@
-1,6
+1,3
@@
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
import wx
import wx
@@
-34,8
+31,6
@@
class TestPanel(wx.Panel):
t = wx.StaticText(self, -1, "PopupMenu")
t.SetFont(bf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
t = wx.StaticText(self, -1, "PopupMenu")
t.SetFont(bf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
- self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
-
box.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)
box.Add((10,20))
box.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)
box.Add((10,20))
@@
-43,14
+38,15
@@
class TestPanel(wx.Panel):
t = wx.StaticText(self, -1, text)
t.SetFont(nf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
t = wx.StaticText(self, -1, text)
t.SetFont(nf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
+ t.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
self.SetSizer(box)
self.SetSizer(box)
- self.Bind(wx.EVT_
RIGHT_UP, self.OnRightClick
)
+ self.Bind(wx.EVT_
CONTEXT_MENU, self.OnContextMenu
)
- def On
RightClick
(self, event):
- self.log.WriteText("On
RightClick
\n")
+ def On
ContextMenu
(self, event):
+ self.log.WriteText("On
ContextMenu
\n")
# only do this part the first time so the events are only bound once
#
# only do this part the first time so the events are only bound once
#
@@
-82,7
+78,8
@@
class TestPanel(wx.Panel):
menu = wx.Menu()
# Show how to put an icon in the menu
item = wx.MenuItem(menu, self.popupID1,"One")
menu = wx.Menu()
# Show how to put an icon in the menu
item = wx.MenuItem(menu, self.popupID1,"One")
- item.SetBitmap(images.getSmilesBitmap())
+ bmp = images.getSmilesBitmap()
+ item.SetBitmap(bmp)
menu.AppendItem(item)
# add some other items
menu.Append(self.popupID2, "Two")
menu.AppendItem(item)
# add some other items
menu.Append(self.popupID2, "Two")
@@
-99,7
+96,7
@@
class TestPanel(wx.Panel):
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
- self.PopupMenu(menu
, event.GetPosition()
)
+ self.PopupMenu(menu)
menu.Destroy()
menu.Destroy()
@@
-155,5
+152,5
@@
overview = """<html><body>
if __name__ == '__main__':
import sys,os
import run
if __name__ == '__main__':
import sys,os
import run
- run.main(['', os.path.basename(sys.argv[0])])
+ run.main(['', os.path.basename(sys.argv[0])]
+ sys.argv[1:]
)