[wxPython-users] ANN: FancyButtonPanel Control For wxPython

Robin Dunn robin at alldunn.com
Tue Oct 3 10:44:36 PDT 2006


Michele Petrazzo wrote:
> Andrea Gavana wrote:
>> Hello NG,
>>
> 
> Hi Andrea,
> 
>> The widget has been tested on wxPython 2.6.3.3, with Python 2.4 on 
>> Windows XP.
>>
> 
> Tried on linux with wx 2.6 and 2.7 and found a problem:
> when I resize the frame, if I increase its size, all work, but is I
> decrease, the FancyButtonPanel don't resize itself.
> 
> After some tries, I see that GetClientRect (line 301), don't return the
> right size (may be a wx bug?),

It is happening because the panel doesn't have a best size or min size 
defined, so the sizer is always using the current size as the best size. 
  Although the behavior on Windows is more agreeable in this instance, I 
think it is the one that is incorrect according to the current 
definitions.  However I'm surprised to see the platforms behaving 
differently here because the code in question is shared between 
platforms.  I'll see if I can figure out what is going on...


> so I add a simple patch that solve this:
> 
> #Line 302
> 
> if not sys.platform.startswith("win"):
>   #Bug solver for gtk
>   parent_w = self.GetParent().GetSize()[0]
>   rect = list(rect)
>   rect = rect[:2] + [parent_w] + [rect[3]]
>   rect = wx.Rect(*rect)

Or you could save yourself a little confusion and replace the last three 
lines with

	rect.width = parent_w

;-)

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list