eric_dex...@msn.com wrote:
I managed to get the program running and the menu options are
appearing on the list but the programs are not running. I suspect it
is my onexecutemethod
[snip]
#add execute files from the text file list
idtool = 400
for e in menuoptions:
wx.EVT_MENU(self, idtool, self.OnExecute(idtool, e))
This calls the OnExecute method and then passes its result to
wx.EVT_MENU. If, for example, OnExecute is returning None, then that's
what is being passed into wx.EVT_MENU.
What you should actually be doing is passing a function which can be
called when the menu item is clicked, something like this:
wx.EVT_MENU(self, idtool, lambda idtool=idtool, e=e:
self.OnExecute(idtool, e))
idtool += 1
##print e
[snip]
def OnExecute(self,tool,e):
print tool
os.system(e)
#print tool
# Get rid of the dialog to keep things tidy
[snip]
--
http://mail.python.org/mailman/listinfo/python-list