问题描述
使用 self.GetParent().FindWindowById(wx.ID_FORWARD).Disable()
我可以完全禁用下一个按钮,但我只希望向导中的第二页有一个禁用按钮,直到满足条件.如果同时创建所有页面,如何防止下一个按钮被禁用,直到我到达第二个页面?
Using self.GetParent().FindWindowById(wx.ID_FORWARD).Disable()
I am able to disable the next button altogether, but I only want my second page in the Wizard to have a disabled button until a condition is met. How can I prevent the next button from being disabled until I reach the second page if all pages are created at once?
推荐答案
该向导非常酷,除非您真的想要修改此类内容.我猜你必须跟踪你所在的页面,然后调用这样的东西(这是你已经知道的):
The wizard is pretty cool until you actually want to modify stuff like this. I am guessing you will have to keep track of which page you're on and then call something like this (which is what you already know):
forward_btn = self.FindWindowById(wx.ID_FORWARD)
forward_btn.Disable()
您或许可以使用 event.GetPage() 来确定您所在的页面.或者,您可以使用一些面板重新实现向导,然后以这种方式进行切换.我个人认为这会更容易.我有一个面板切换示例 博客可能对你有帮助.
You can probably use event.GetPage() to figure out which page you're on. Or you could just re-implement the wizard with some panels and do the switching that way. Personally I think that would be easier. I have an example of panel switching on my blog that might help you.
您可能还会发现这真的 通用实现我提出的向导也很有帮助.
You might also find this really generic implementation of a Wizard that I came up helpful too.
这篇关于禁用“下一步"按钮,直到在 wx.WizardPageSimple 的单页上满足条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!