aquabutton - exception on resize

If resizing a panel containing aquabutton I get this exception when size is getting small.

root - ERROR - app_base.py - 343 - Traceback (most recent call last):
   File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\lib\agw\aquabutton.py", line 348, in OnPaint
     self._storedBitmap = wx.EmptyBitmapRGBA(width, height)
   File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\_gdi.py", line 1009, in EmptyBitmapRGBA
     return _gdi_._EmptyBitmapRGBA(width, height, red, green, blue, alpha)
ValueError: Width and height must be greater than zero

A work around is to change line 348 from:

             self._storedBitmap = wx.EmptyBitmapRGBA(width, height)

to:

             self._storedBitmap = wx.EmptyBitmapRGBA(width+1, height+1)

A bit of a hack, one should probably check for zero and only then add 1.

Werner

I usually do something like (max(width,1), max(height,1))

···

On 11/23/11 11:37 PM, werner wrote:

If resizing a panel containing aquabutton I get this exception when size
is getting small.

root - ERROR - app_base.py - 343 - Traceback (most recent call last):
File
"c:\python27\lib\site-packages\wx-2.9.2-msw\wx\lib\agw\aquabutton.py",
line 348, in OnPaint
self._storedBitmap = wx.EmptyBitmapRGBA(width, height)
File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\_gdi.py", line 1009,
in EmptyBitmapRGBA
return _gdi_._EmptyBitmapRGBA(width, height, red, green, blue, alpha)
ValueError: Width and height must be greater than zero

A work around is to change line 348 from:

self._storedBitmap = wx.EmptyBitmapRGBA(width, height)

to:

self._storedBitmap = wx.EmptyBitmapRGBA(width+1, height+1)

A bit of a hack, one should probably check for zero and only then add 1.

--
Robin Dunn
Software Craftsman

Hi Werner,

···

On 24 November 2011 08:37, werner wrote:

If resizing a panel containing aquabutton I get this exception when size is
getting small.

root - ERROR - app_base.py - 343 - Traceback (most recent call last):
File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\lib\agw\aquabutton.py",
line 348, in OnPaint
self._storedBitmap = wx.EmptyBitmapRGBA(width, height)
File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\_gdi.py", line 1009, in
EmptyBitmapRGBA
return _gdi_._EmptyBitmapRGBA(width, height, red, green, blue, alpha)
ValueError: Width and height must be greater than zero

A work around is to change line 348 from:

       self\.\_storedBitmap = wx\.EmptyBitmapRGBA\(width, height\)

to:

       self\.\_storedBitmap = wx\.EmptyBitmapRGBA\(width\+1, height\+1\)

A bit of a hack, one should probably check for zero and only then add 1.

Thank you for the bug report, it should be fixed now in SVN.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Thanks for the update
Werner

···

On 11/24/2011 11:39 PM, Andrea Gavana wrote:

Hi Werner,

On 24 November 2011 08:37, werner wrote:

If resizing a panel containing aquabutton I get this exception when size is
getting small.

root - ERROR - app_base.py - 343 - Traceback (most recent call last):
  File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\lib\agw\aquabutton.py",
line 348, in OnPaint
    self._storedBitmap = wx.EmptyBitmapRGBA(width, height)
  File "c:\python27\lib\site-packages\wx-2.9.2-msw\wx\_gdi.py", line 1009, in
EmptyBitmapRGBA
    return _gdi_._EmptyBitmapRGBA(width, height, red, green, blue, alpha)
ValueError: Width and height must be greater than zero

A work around is to change line 348 from:

            self._storedBitmap = wx.EmptyBitmapRGBA(width, height)

to:

            self._storedBitmap = wx.EmptyBitmapRGBA(width+1, height+1)

A bit of a hack, one should probably check for zero and only then add 1.

Thank you for the bug report, it should be fixed now in SVN.