Hey List people,
I'm having some trouble with my popup menu. i don't know what I am
supposed to do. I'm trying to do the same as whats on the demo but it
doesn't work.
Here is the code.
Cheers
Naeill
···
_____________________
class MyEvtHandler(ogl.ShapeEvtHandler):
def __init__(self):
ogl.ShapeEvtHandler.__init__(self)
def OnLeftClick(self, x, y, keys=0, attachment=0):
shape = self.GetShape()
canvas = shape.GetCanvas()
dc = wx.ClientDC(canvas)
canvas.PrepareDC(dc)
if (shape.Selected() == True):
shape.Select(False, dc)
canvas.Redraw(dc)
else:
shape.Select(True, dc)
canvas.Redraw(dc)
def OnLeftDoubleClick(self, x, y, keys=0, attachment=0):
shape = self.GetShape()
canvas = shape.GetCanvas()
dc = wx.ClientDC(canvas)
canvas.PrepareDC(dc)
self.Properties()
def Properties(self):
dia = MainWindow(None, -1, "Please Edit Attributes")
dia.Destroy()
def OnRightClick(self, *dontcare):
shape = self.GetShape()
canvas = shape.GetCanvas()
frame = self.statbarFrame
if (shape.Selected() == True):
self.popupID1 = wx.NewId()
self.popupID2 = wx.NewId()
# self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
# self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2)
menu = wx.Menu()
item = wx.MenuItem(menu, self.popupID1,"Properties")
menu.AppendItem(item)
menu.Append(self.popupID2, "Delete")
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
self.PopupMenu(menu)
menu.Destroy()
else:
pass
canvas.Refresh()
________________________________