Trouble putting a rounded button on a gradient background

I need to place a bitmapbutton that has curved edges on a gradient
background, and failing miserably. I'm wondering if anyone might have
any tips for how to do this?

I posted a stripped down fully working example of the problem and my
progress here:

http://sinkingsensation.com/dropbox/buttontest.zip

In a nutshell, the transparency of the button is appearing as gray,
and the selected state, which is a smaller version of the regular
state, is leaving an imprint of the non-selected state.

Update: I got rid of the artifact shown when the button is pressed by
refreshing the button when its pressed (see updated source), but the
issue of placing a transparent rounded button on a picture remains.

Hi,

Update: I got rid of the artifact shown when the button is pressed by
refreshing the button when its pressed (see updated source), but the
issue of placing a transparent rounded button on a picture remains.

You could try with the PlateButton (wx.lib.platebtn) instead it has
better support for transparency.

If your on Windows you will need to pass it the PB_STYLE_NOBG style
flag to help with transparency issues on gradient backgrounds.

If your on OSX it will work by itself

If your on Linux/GTK your out of luck

Cody

···

On Tue, Mar 9, 2010 at 9:13 AM, wrybread <wrybread@gmail.com> wrote:

Thanks, that puts me almost there. Remaining issues:

- with platebtn I can't figure out how to get rid of the hover
graphic. I tried subclassing as per your instructions in this thread
( http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3681786
) but I must be doing something wrong because I'm not able to pass any
style, and its not suppressing the hover graphic.

- I also can't set BitmapSelected. Is it possible to have a different
graphic when the button is clicked? Or to simply have the button
shrink a bit, giving a button 3-d effect?

I added "test2.py" to my sample application here:

http://sinkingsensation.com/dropbox/buttontest.zip

Hi,

Thanks, that puts me almost there. Remaining issues:

- with platebtn I can't figure out how to get rid of the hover
graphic. I tried subclassing as per your instructions in this thread
( ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.
) but I must be doing something wrong because I'm not able to pass any
style, and its not suppressing the hover graphic.

You cant suppress it, I don't think I would accept a patch for a style
to allow suppressing it either but would consider evaluating it.

The other issue is for the control accepting the focus automatically
when its parent panel is clicked upon. You can override that behavior
with the suggestion in the other post.

- I also can't set BitmapSelected. Is it possible to have a different
graphic when the button is clicked? Or to simply have the button
shrink a bit, giving a button 3-d effect?

Currently SetBitmapSelected is just mapped to SetBitmap. Patch to
allow for setting a separate selected bitmap would be accepted.

The PlateButton is intended to be a flat button. The buttons border
and background of the button are redrawn to give feedback when it is
pressed.

Cody

···

On Tue, Mar 9, 2010 at 10:21 AM, wrybread <wrybread@gmail.com> wrote:

Thanks for the tips. I was able to suppress the the mouseover
highlighting by modifying the module itself, which works but is of
course sloppy. I haven't been able to get a SetBitmapSelected property
working though, and, because of my sloppy hacks, I'm still stuck with
quite a bit of flicker when the button is changing states.

If anyone has any other suggestions, I'd love to hear them.

If you look at the ButtonPanel in the demo, Andrea puts a button made
from a transparent PNG on a gradient background; maybe that will give
you some ideas?

Che

···

On Tue, Mar 9, 2010 at 12:56 PM, wrybread <wrybread@gmail.com> wrote:

Thanks for the tips. I was able to suppress the the mouseover
highlighting by modifying the module itself, which works but is of
course sloppy. I haven't been able to get a SetBitmapSelected property
working though, and, because of my sloppy hacks, I'm still stuck with
quite a bit of flicker when the button is changing states.

If anyone has any other suggestions, I'd love to hear them.