How can I add a outline border to a widget in wxpython? (Any widget, for example, a wx.Button
)
For panel, you can use
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
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'))
For any widget, i think you can always create a wx.Panel
with some border and put the widget into the panel.
There's no easy way to change how 'standard' widgets look like in wxPython ('standard' I mean wx.Button, wx.CheckBox, etc.), because they use native controls of your underlying OS window manager and you can't change that.
Your way to go is to dig into wx.lib
where you can find better generic controls and windows that don't use native controls but prefer custom rendering of those.
If you want to have better control on your buttons, use wx.lib.buttons
. The same rule applies to other controls - look at wx.lib
.
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.