Oscar Gustafsson wrote:
Dear wxPythoners,
(wxPython 2.4.2.4, as we have not upgraded our source yet...)
how do I make a button that consists of a bitmap and a bitmap only
without any borders?
wxBitmapButton adds a few pixels around it, as do wxGenBitmapButton.
I would really only want to capture a click on a bitmap, so maybe I do not
need an actual button. "Pressing down" the button is hence not required.
My best idea so far is to copy the wxGenButton code and remove the
Bezel-calls, but it seems like a more trivial task than using all that.
Any samples or pointers are much appreciated.
/Oscar Gustafsson
I'm pretty sure I just did this with a wxBitmapButton. The only thing I had to do was *not* set wxBU_AUTODRAW, and set wxNO_3D.
At that point all I had to do was:
self.bmpButton = wxBitmapButton(bitmap=wxEmptyBitmap(16, 16),
id=wxID_VIEWCTPANELBMPBUTTON, name=u'bmpButton',
parent=self, pos=wxPoint(703, 2),
size=wxSize(16, 16), style=wxNO_3D)
EVT_BUTTON(self.bmpButton, wxID_VIEWCTPANELBMPBUTTON,
self.OnBmpButtonButton)
# This happens later
self.bmpButton.SetBitmapSelected(bmpDown)
self.bmpButton.SetBitmapFocus(bmpUp)
self.bmpButton.SetBitmapLabel(bmpUp)
Now, I have the bitmap change when it is pushed, so you probably could set all of them to the same bitmap. I set it to the empty bitmap, because I haven't loaded the bitmap at the time of initialization.
But this should give you the idea.
John
=:->