0

I'm working on an addon system for one of my projects.
I'm able to add a new menu item, but the self.Bind(...) is causing me troubles

instead of bind the function to the menu-item, it just calls the function. and doesn't bind at all... :s

self.ID_OPEN=wx.NewId()
wxglade_tmp_menu.Append(self.ID_OPEN, eval(menucontent)[i][0], "", eval("wx.ITEM_"+eval(menucontent)[i][1]))
exec("import "+add+"."+imprts)
self.Bind(wx.EVT_MENU, eval(add+"."+imprts+"."+str(eval(menucontent)[i][2])), id=self.ID_OPEN)

with an example input:

self.ID_OPEN=wx.NewId()
wxglade_tmp_menu.Append(self.ID_OPEN, "DJANGO", "", wx.ITEM_NORMAL))
exec("import DGO.imports")
self.Bind(wx.EVT_MENU, DGO.imports.dgo(), id=self.ID_OPEN)

I really don't know why this calls the dgo() function direct on startup and not when I click on the menu-item

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Kruptein
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.