Explicitly choosing the ID

First and most straightforwardly, you can explicitly pass a positive integer into the constructor—that number becomes the widget's ID. If you pass a specific number, it is your responsibility to make sure that you do not duplicate ID numbers within a frame or reuse one of the predefined constants. You can ensure that wxPython does not use your explicit ID elsewhere in the application by calling the global function wx.RegisterId(). To prevent your program from duplicating wxPython

IDs, you should avoid using ID numbers between the global constants wx.id_lowest and wx.ID_HIGHEST.

Was this article helpful?

0 0

Post a comment