PlateButton does not display solid background correctly

Hi,

I have a problem with PlateButton not showing solid background as it

should. See screen shots from the wxPython Demo below. The gradient
background looks OK though. I’m running wxPython 2.9.4, Python 2.7.3
(32bit) on Win 7 64bit

Anybody knows what is going on? Any suggestions on how to fix it?

/Max

![hegbiebj.png|293x165](upload://mv16bmiBI5HbdZDmwkq09QMeDju.png)

![hbjjbjic.png|271x214](upload://Arb6eqTvkTBp0fgWx9S5rAn1Azk.png)

Hi,

···

On Thu, Dec 6, 2012 at 12:48 PM, Max Landaeus max@landaeus.com wrote:

Hi,

I have a problem with PlateButton not showing solid background as it should. See screen shots from the wxPython Demo below. The gradient background looks OK though. I’m running wxPython 2.9.4, Python 2.7.3 (32bit) on Win 7 64bit

Anybody knows what is going on? Any suggestions on how to fix it?

Looks like something has changed in 2.9 in regards to the window buffering and erase background behavior (again…).

Will need to make an update to the control but from some quick testing on windows the following fixes the issue:

===================================================================
— platebtn.py (revision 73136)
+++ platebtn.py (working copy)
@@ -254,14 +254,7 @@

 def __DrawButton(self):
     """Draw the button"""
  •    # TODO using a buffered paintdc on windows with the nobg style
    
  •    #      causes lots of weird drawing. So currently the use of a
    
  •    #      buffered dc is dissabled for this style.
    
  •    if PB_STYLE_NOBG & self._style:
    
  •        dc = wx.PaintDC(self)
    
  •    else:
    
  •        dc = wx.AutoBufferedPaintDCFactory(self)
    
  •    dc = wx.PaintDC(self)
       gc = wx.GCDC(dc)
    
       # Setup
    

@@ -502,7 +495,10 @@

     @param evt: wx.EVT_ERASE_BACKGROUND

     """
  •    pass
    
  •    if PB_STYLE_NOBG & self._style:
    
  •        pass
    
  •    else:
    
  •        evt.Skip()
    

    def OnFocus(self, evt):

       """Set the visual focus state if need be"""
    

Will need to test on other platforms before pushing update out.

You may be able to work around this in your code currently by creating a subclass of PlateButton, overriding OnErase to Skip() the event and specifying PB_STYLE_NOBG style flag when creating the buttons.

Cody

Hats off gentlemen! A patch in 30 minutes!

Thanks a lot Cody,

Max
···

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en