简体   繁体   中英

wxpython transparent button

I am trying to design 650px x 100px button in an application.

The rectangle contains an icon on the left and a text on the right.

In order to make everything act like a button I was considering adding a transparent button on top of the text and icon but SetTransparent has no effect and adding a mask raises an exception as SetMask does not exists for BitmapButton .

bitmap = wx.EmptyBitmap(650, 100)
button = wx.BitmapButton(panel, -1, bitmap=bitmap, pos=(100, 0), size=(650, 100), style=0)

Has anyone done something like this successfully or can suggest a course of action that would help my case?

I have worked with GTK in the past and where there is an EventBox that can contain anything and have events bind to it.

wxPython doesn't really support that. Transparency is an all or nothing affair where either everything in your app is transparent or none of it is. You can do gradients if you use the PlateButton or the AquaButton though. Or you might be able to do something if you drew the button yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM