[wxPython-users] [ANN] PlateButton Control for wxPython

Peter Damoc pdamoc at gmail.com
Thu Dec 13 06:21:30 PST 2007


Hi Cody,

Here is a small piece of code it might help:


def HSB2RGB(hsb):
    """ hsb format: angle(hue).saturation.brightness"""
    h,s, b =3D map(int, hsb.split("."))
    return map(lambda x: int(x*255), colorsys.hsv_to_rgb(h/360., s/100.,
b/100.))

I discovered that it is so much better to work in HSB when trying to work
with colors.
I put this piece of code because I saw the AdjustColour method.

Also (this is a pet peeve) please try and make the demo sexy. I know it is a
quick and dirty thing but seeing bad edges on icons and mask elements
creeping into the picture gives an impression of amateur sloppiness and I
know your are not an amateur. With the risk of increasing the demo size,
pack in some nice PNG icons with proper transparency, nice shadows... that
kind of thing.

Peter

On Dec 13, 2007 4:05 PM, Cody Precord <codyprecord at gmail.com> wrote:

> Greetings,
>
> The PlateButton is a custom owner drawn button control that in many
> ways emulates the buttons found on Safari's bookmark bar. It  also
> offers a near complete implementation of the wxBitmapButton api and
> can as such be used as a drop in replacement for wxButton/
> wxBitmapButton under most circumstances.
>
>
> Some Features:
> - Four main style options
>   - PB_STYLE_DEFAULT: Rounded shaped button with highlight color
> from current system theme
>   - PB_STYLE_GRADIENT: Use a gradient highlight for focus and press
> states
>   - PB_STYLE_SQUARE: Use a square shaped button
>   - PB_STYLE_NOBG: Useful to get transparent appearance on Windows
> when parent window has a custom painted background.
> - Fully customizable colors/fonts/ect..
> - Use a Bitmap as a button, or just text, or both
> - Optional drop down menu
> - Change/Add bitmap, label, color, font at anytime and button updates
> instantly
> - Transparent background lets it fit in on windows with non standard
> backgrounds (not completely working on gtk yet)
>
>
> Known issues:
> - Windows: Popup menu for some reason causes button to revert back to
> normal state when it should be in a pressed state till menu is
> dismissed.
> - Windows: PopupMenu doesn't seem to fire an EVT_MENU_CLOSE as it
> does on Mac/Gtk which will under some circumstances leave the button
> in the wrong state after dismissing the menu.
> - Gtk: Transparency (or the faking of it) doesn't work for non solid
> backgrounds (see Gradient Panel in demo)
>
>
> For a more complete picture download the source and run the included
> demo (PlateButtonDemo.py):
>
> Requirements:
> python 2.4+, wxPython 2.8
>
> Download Link:
> http://editra.org/uploads/code/PlateButton.tar.gz
>
>
> Bug reports and ideas for enhancement are of course very welcomed so
> let me know
>
>
> Enjoy,
>
> Cody Precord
> http://editra.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>


-- =

There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200712=
13/85a2c599/attachment.htm


More information about the wxpython-users mailing list