如何向小部件添加轮廓边框? [英] How to add an outline border to a widget?
本文介绍了如何向小部件添加轮廓边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 wxpython 中为小部件添加轮廓边框?(任何小部件,例如 wx.Button
)
How can I add a outline border to a widget in wxpython? (Any widget, for example, a wx.Button
)
推荐答案
对于面板,可以使用
p = wx.Panel(....., style=wx.SUNKEN_BORDER)
在那里你可以选择常量:
there you can choose from constants:
wx.SIMPLE_BORDER
wx.RAISED_BORDER
wx.SUNKEN_BORDER
wx.NO_BORDER
如果您想在 wx.Button
周围创建边框,我将使用带有 wx.BitmapButton
的自定义位图:
If you want to create border around wx.Button
, i would use my custom bitmap with wx.BitmapButton
:
b = wx.BitmapButton(pane, -1, wx.Bitmap('buttons/my_beautiful_button.png'))
对于任何小部件,我认为您始终可以创建一个带有一些边框的 wx.Panel
并将小部件放入面板中.
For any widget, i think you can always create a wx.Panel
with some border and put the widget into the panel.
这篇关于如何向小部件添加轮廓边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文