wxGlade

Brian Kelley bkelley at wi.mit.edu
Thu Feb 19 20:12:56 EST 2004


Markus Faltin wrote:
> I'm a newbie regarding wxPython, nevertheless I worked this out:
> 
> 
>>class MyFrame(wxFrame):
>>     def __init__(self, *args, **kwds):
>>         # begin wxGlade: MyFrame.__init__
>>         kwds["style"] = wxDEFAULT_FRAME_STYLE
>>         wxFrame.__init__(self, *args, **kwds)
>>         self.button_1 = wxButton(self, -1, "button_1")
>>         self.__set_properties()
>>         self.__do_layout()
>>         # end wxGlade
>>         EVT_BUTTON(self, 1003, self.event)
> 
> 
> You have to set the identifier of the button:
>           self.button_1 = wxButton(self, 1003, "button_1")

Not necessarily,  you can keep the -1 designation and then
EVT_BUTTON(self, self.button_1.GetId(), self.event)

I prefer this method since it is less book keeping for me.

Brian Kelley




More information about the Python-list mailing list