I have a ButtonPanel and want all the buttons to be the same width. Setting the rect with SetRect() appears to have no effect. Does anyone know a way to do this?
Ron
I have a ButtonPanel and want all the buttons to be the same width. Setting the rect with SetRect() appears to have no effect. Does anyone know a way to do this?
Ron
Ron Kneusel wrote:
I have a ButtonPanel and want all the buttons to be the same width. Setting the rect with SetRect() appears to have no effect. Does anyone know a way to do this?
Ron
Try making all the buttons the same size using their size parameter in the wx.Button() constructor. I've done something like this before:
<code>
# untested
btnSize = ((30, -1))
myBtn = wx.Button(panel, wx.ID_ANY, size=btnSize)
</code>
HTH
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
Mike Driscoll wrote:
Ron Kneusel wrote:
I have a ButtonPanel and want all the buttons to be the same width.
Setting the rect with SetRect() appears to have no effect. Does
anyone know a way to do this?Ron
Try making all the buttons the same size using their size parameter in
the wx.Button() constructor. I’ve done something like this before:# untested
btnSize = ((30, -1))
myBtn = wx.Button(panel, wx.ID_ANY, size=btnSize)
Thanks for the tip. The ButtonPanel class uses ButtonInfo to create its buttons and does not allow a size parameter, unfortunately.
Ron
Ron Kneusel wrote:
Mike Driscoll wrote:
> Ron Kneusel wrote:
> > I have a ButtonPanel and want all the buttons to be the same width.
> > Setting the rect with SetRect() appears to have no effect. Does
> > anyone know a way to do this?
> >
> > Ron
> >
> Try making all the buttons the same size using their size parameter in
> the wx.Button() constructor. I've done something like this before:
>
> <code>
> # untested
>
> btnSize = ((30, -1))
> myBtn = wx.Button(panel, wx.ID_ANY, size=btnSize)
>
> </code>Thanks for the tip. The ButtonPanel class uses ButtonInfo to create its buttons and does not allow a size parameter, unfortunately.
Derive a new class from ButtonInfo and override GetBestSize.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin Dunn wrote:
Thanks for the tip. The ButtonPanel class uses ButtonInfo to create its
buttons and does not allow a size parameter, unfortunately.Derive a new class from ButtonInfo and override GetBestSize.
Ah… I’ll try it. Thanks!
Ron
Your PC, mobile phone, and online services work together like never before. See how Windows® fits your life