wx.FRAME_EX_CONTEXTHELP对应的Event是什么?
程序如下, 可以正常显示“上下文帮助按钮”,为什么点击了上下文帮助按钮后,没有触发OnHelp? 这个按钮对应的事件到底是什么?
import wx
class MyFrame(wx.Frame):
def __init__(self, parent=None, id=-1, title='Test'):
wx.Frame.__init__(self, parent, id, title, style = wx.CAPTION | wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.FRAME_EX_CONTEXTHELP)
self.SetExtraStyle(wx.FRAME_EX_CONTEXTHELP)
self.Center()
ico = wx.Icon('test.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(ico)
self.Bind(wx.EVT_HELP, self.OnHelp)
def OnHelp(self, evt):
wx.MessageBox("This is an example", "Help", wx.OK | wx.ICON_INFORMATION, self)
if __name__ == '__main__':
app = wx.App(False)
frame = MyFrame();
frame.Show()
app.MainLoop()
[解决办法]
需要提示帮助的控件去绑定事件,一般应该不是容器类的,试试改用一个按钮...
btn = wx.Button(self, -1, 'aaa')
self.Bind(wx.EVT_HELP, self.OnHelp, btn)