List Info

Thread: Question about wx.BitmapButton and sizers...




Question about wx.BitmapButton and sizers...
user name
2007-10-20 06:03:07
I have a row of BitmapButtons that I'm putting into a box sizer, and I'd like them to have the 3d border, aka style=wx.BU_AUTODRAW. The problem is that the 3d border expands beyond the size of the bitmap button, which looks bad.

Is there some way to specify a maximum size for the button border? Or some other clever way to give feedback when the button is clicked?

Some code. In the below example, the background border of pic2 expands beyond the size of the graphic.

   ;     panel = wx.Panel(self, -1, style = wx.SIMPLE_BORDER)
        box = wx.BoxSizer(wx.HORIZONTAL) :

     ;   pic1 = wx.BitmapButton(panel, -1, wx.Bitmap('utils/assets/eye-icon.png9;), style=wx.NO_BORDER )  ;     
        pic2 = wx.BitmapButton(panel, -1, wx.Bitmap('utils/assets/eye-icon.png9;), style=wx.BU_AUTODRAW | wx.BU_EXACTFIT) # with 3d border     
        pic3 = wx.BitmapButton(panel, -1, wx.Bitmap('utils/assets/eye- icon.png'), style=wx.NO_BORDER)      

       ; box.Add(pic1, 1, wx.ALIGN_CENTER)
        box.Add(pic2, 1, wx.ALIGN_CENTER)
        box.Add(pic3, 1, wx.ALIGN_CENTER)
       
        panel.SetSizer(box)

        self.Centre()


Re: Question about wx.BitmapButton and sizers...
country flaguser name
United States
2007-10-20 21:45:42
Alec Bennett wrote:
> I have a row of BitmapButtons that I'm putting into a
box sizer, and I'd 
> like them to have the 3d border, aka
style=wx.BU_AUTODRAW. The problem 
> is that the 3d border expands beyond the size of the
bitmap button, 
> which looks bad.
> 
> Is there some way to specify a maximum size for the
button border? Or 
> some other clever way to give feedback when the button
is clicked?

No, you either get the platform border as-is, or you need to
provide 
your own bitmaps for the various states.  There is also the
generic 
button classes in wx.lib.buttons.


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


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )