How to add an outline border to a widget?

user1513192 picture user1513192 · Aug 12, 2012 · Viewed 7.8k times · Source

How can I add a outline border to a widget in wxpython? (Any widget, for example, a wx.Button)

Answer

Stanislav Heller picture Stanislav Heller · Aug 12, 2012

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.