Robert Liebeskind wrote:
Hi Mike,
Thanks for your reply. I am not sure how to keep the conversation thread going.. Perhaps I should reply some other way? Below is my original message and your response.
I am not re-assigning cancel before trying to act on the menuitem. Here is the relevant snippet
of code:tmp_menu = wx.Menu()
if rx['Status'] == 'Printed':
cancel = tmp_menu.Append(-1, "Reject", "", wx.ITEM_NORMAL)
else:
cancel = tmp_menu.Append(-1, "Cancel", "", wx.ITEM_NORMAL)
Id = cancel.GetId()The error occurs when I call cancel.GetId()
Any other ideas?
I'm not seeing anything obvious. I tried adding a GetId() to some of my sample code and it worked for me. Here's my sample code. Maybe you can see the difference between mine and yours (I also included a little introspection with "type" and "dir):
<code>
import wx
class MainWindow(wx.Frame):
def __init__(self, parent = None, id = -1, title = "Small Editor"):
wx.Frame.__init__(
self, parent, id ,title, size = (400,200),
style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE
)
self.control = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE)
#--- START MENU CODE:
···
---------------------------------------------------
self.CreateStatusBar()
#------ Setting up the menu.
filemenu = wx.Menu()
about = filemenu.Append(-1, "&About", "Information about this program")
print type(about)
print
print dir(about)
print
print about.GetId()
filemenu.AppendSeparator()
filemenu.Append(-1, "E&xit", "Terminate the program")
#------ Creating the menu.
menubar = wx.MenuBar()
menubar.Append(filemenu, "&File")
self.SetMenuBar(menubar)
#--- END MENU CODE ------------------------------------------------------
self.Show(True)
app = wx.PySimpleApp()
frame = MainWindow()
app.MainLoop()
</code>
Can you tell me how to properly respond to the mail list?
Sometimes you need to hit "Reply All" to get the wxPython email address in the TO field. But if it's not there, just put it in. Here it is for reference: wxpython-users@lists.wxwidgets.org
Thanks for your help,
Rob.
<snip>
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org