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

Okay nevermind, the people on the python irc, where able to help me...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.