我正在尝试在创建按钮后添加/删除 BitmapButton 的边框。我还没有找到任何工作示例来更新 BitmapButton 的外观。说
self.btn = wx.BitmapButton(self.panel, wx.ID_ANY, bmp, pos=(...))
self.Bind(wx.EVT_BUTTON, self.OnClick, self.btn)
然后在 OnClick 中
def OnClick(self):
# what should be here to give / remove the border of the button being clicked
谢谢
请您参考如下方法:
您需要使用像 SetWindowStyle() 或 SetWindowStyleFlag() 这样的方法,它们由 wx.Window 实现,它是所有 wxWidgets 窗口,并记录 here .
例如,对于边框,试试这个:
btn.SetWindowStyleFlag(wx.SIMPLE_BORDER)
# or
btn.SetWindowStyleFlag(wx.NO_BORDER)
