I'm working on an add-on system, which is till now going pretty good.
no I need to assign an id to a menu item, but I don't know which are all in use (by other addons f.e.) so is there a way to either:
-get a random integer that isn't used as id yet
-get a list with integers that is already used as id
(the first would be better though)...
Here is a quick program to get all the current ones. But it really doesn't matter if you overwrite them for the most part anyway. The chance of you doing that is also very small
import wx for f in dir(wx): if f.startswith("ID_"): print f, eval('wx.'+f)
This will print the name of the ID with the corresponding value. They are all four digit though, so you could get around your problem by having 1,2,3,5,6 or 7 digit numbers.
Hope that helps! :D
Uhu that's possible,
but is it possible to do something like this:
wxglade_tmp_menu.Append("str", "&Open", "", wx.ITEM_NORMAL) self.menubar.Append(wxglade_tmp_menu, menutitle) self.Bind(wx.EVT_MENU, self.ttt, "str")
I want to give a variable name instead of an id... is that somehow possible?
cause the example does not work :p
From my understanding all you would need to do is:
self.ID_OPEN=wx.NewId() wxglade_tmp_menu.Append(self.ID_OPEN, "&Open", "", wx.ITEM_NORMAL) self.menubar.Append(wxglade_tmp_menu, menutitle) self.Bind(wx.EVT_MENU, self.ttt, id=self.ID_OPEN)
I'm pretty sure that wx.NewId() will get a new ID that is not in use. This has always worked for me!
Edited by winmic: edited code
Thanks a lot! that's exactly what I neede :)
I'm coding a program to learn OpenGL in C++ (based off of The Benny Boxes tutorials) and I've run into a snag where I don't get any errors, but my ...
I want to implement undo logic which deletes the last drawn shape. To test this logic i had cleared shapes list and redrawn all shapes but still last ...
Please tell me why triangle shape is redrawing on mouse move. It want triangle shape draw only once until mouse release.
Here is my code below. Thank you ...