Button FX: Resizing/Activating/Relabeling

Martin Braun braun at int.uni-karlsruhe.de
Wed Jan 9 08:48:53 PST 2008


Hi,

I'd like to create a button the same (dynamic) size as the BoxSizer it's in. 
Trouble is, my buttons are always the same size. I've tried using wx.EXPAND 
like this (note I'm using wxPython):

    hbox.Add(self.button_tl, 0, wx.EXPAND)

didn't work. I tried grabbing the size from the hbox and explicitly setting 
it, didn't work either:

    self.button_tl.SetSize(hbox.GetSize())


The other problem I have, when the button is clicked, I want it to have a 
different label. Trouble is, when I use SetLabel(), it also changes the state 
of the button, so now my button always appears un-press (although it changes 
it's label). Is there a way of explicitly telling a button to looked pressed?
This would also solve my third, related problem: I'd also like the button to 
appear pressed when other stuff happens in my program, so I need a way of 
telling the button when to look pressed.

Thanks for any help - I'm still a bit unfamiliar with wx.

I'm running this on a Linux box.

cheers,
mb


-- 
Martin Braun
Institut fuer Nachrichtentechnik
Universitaet Karlsruhe

http://www.int.uni-karlsruhe.de




More information about the wx-users mailing list