문제

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

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top