开发者

wx python bitmap/toggle/menu button

开发者 https://www.devze.com 2023-03-07 07:04 出处:网络
I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot).I can\'t figure out a way to do this in wx python.Here are the things I\'ve tried and why the

I need a button that has a bitmap, toggles, and to which I can add a menu (I realize this is asking a lot). I can't figure out a way to do this in wx python. Here are the things I've tried and why they don't work:

plate buttons: don't toggle

genbitmaptogglebuttons: for some reason,开发者_运维技巧 these buttons kill my tooltips (I posted this problem earlier and never got an answer)

toolbar buttons: can't add a drop down menu to a button. I would make a separate button for the drop down menu, but the toolbar has to be oriented vertically, and I don't know how to get the drop down button to show up beside its corresponding button, rather than beneath it with vertical a toolbar orientation.

bitmap buttons: won't toggle

Am I missing something obvious? If not I'm just going to resort to faking a toggle by changing the border/background color, unless someone has a better suggestion.

Thanks.


I don't see a pre-built button with all those features. I would think that you can use the generic toggle button or maybe the ShapedButton for your bitmap toggle functionality and attach a right-click popup menu. I'm not really sure what you mean by a menu, so that may not work. If you're talking about a menu implementation similar to the one that the PlateButton has, then you'll probably have to roll your own button. The guys on the wxPython mailing list can tell you how to do that.


Per Mark's suggestion, if you have wx 2.8.12 you can use a plate button to get the toggle/bitmap/menu functionality. Since it is not easy for me to update to the newer wx at this point, I'll use a bitmap button and fake the toggle.

0

精彩评论

暂无评论...
验证码 换一张
取 消