Pergunta

I am trying to add/remove border of BitmapButton AFTER the button been created. I haven't find any working example to update the appearance of BitmapButton. Say

self.btn = wx.BitmapButton(self.panel, wx.ID_ANY, bmp, pos=(...))
self.Bind(wx.EVT_BUTTON, self.OnClick, self.btn)

Then in OnClick

def OnClick(self):
    # what should be here to give / remove the border of the button being clicked

Thanks

Foi útil?

Solução

You need to use methods like SetWindowStyle() or SetWindowStyleFlag(), which are implemented by wx.Window, a common ancestor for all wxWidgets windows, and documented here.

For example, for the border, try this:

btn.SetWindowStyleFlag(wx.SIMPLE_BORDER)
# or
btn.SetWindowStyleFlag(wx.NO_BORDER)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top