【发布时间】:2020-01-07 22:47:39
【问题描述】:
目前我正在完成我的高中毕业项目,但我遇到了一个严重的问题。
我创建了一个 wx.Toolbar,使用 wx.AddTool 添加每个选项,然后我将一些功能绑定到它,它只做所有的东西(在开始时)并且在点击它之后拒绝做任何事情..基本上......它比我想要的要早得多。
我会跳过一些代码,我只会使用需要的代码。
self.frame_toolbar.AddTool(1, "one", Base64ToImg(image1), Base64ToImage(image1-disabled), "One", "First Thing")
self.frame_toolbar.AddTool(2, "two", Base64ToImg(image1), Base64ToImage(image1-disabled), "Two", "Second Thing")
self.frame_toolbar.AddTool(3, "three", Base64ToImg(image1), Base64ToImage(image1-disabled), "Three", "Third Thing")
self.frame_toolbar.Realize()
self.SetToolBar(self.frame_toolbar)
所以现在,我有工具栏,上面有一些工具。现在:
self.Bind(wx.EVT_TOOL, self.onefunction(params), id=1)
self.Bind(wx.EVT_BUTTON, self.twofunction(params), id=2)
self.Bind(wx.EVT_MENU, self.threefunction(params), id=3)
还有
self.frame_toolbar.Bind(wx.EVT_TOOL, self.onefunction(params), id=1)
self.frame_toolbar.Bind(wx.EVT_BUTTON, self.twofunction(params), id=2)
self.frame_toolbar.Bind(wx.EVT_MENU, self.threefunction(params), id=3)
工具栏加载时立即执行。当我点击按钮时,是否可以使其执行ONLY?
非常感谢您的帮助。 回复
【问题讨论】:
标签: python python-3.x wxpython