Windows中的WxPython 2.9:按钮将无法启用()

Windows中的WxPython 2.9:按钮将无法启用(),wxpython,Wxpython,有人能告诉我在什么情况下这会失败吗 self.next_button.Enable( self.__next_enabled ) assert( self.next_button.Enabled == self.__next_enabled ) 我知道这不是一个类型问题--打印self。next\u按钮提供我猜是您自己。启用next\u的变量有时设置为False或0(零)。如果是这样,那么当您使用False调用按钮的Enable函数时,它将禁用该按钮。如果您包含一个小的可运行示例,这会有所帮助

有人能告诉我在什么情况下这会失败吗

self.next_button.Enable( self.__next_enabled )
assert( self.next_button.Enabled == self.__next_enabled )

我知道这不是一个类型问题--
打印self。next\u按钮提供
我猜是您自己。启用next\u的变量有时设置为False或0(零)。如果是这样,那么当您使用False调用按钮的Enable函数时,它将禁用该按钮。如果您包含一个小的可运行示例,这会有所帮助。

如果
self.\uu next\u enabled
False
,那么断言不应该仍然是真的吗?我不太担心按钮的状态,更担心的是为什么按钮没有将其状态设置为我发送到
Enable()
的任何值。(我已经检查过了——变量是
True
def reset_button_states( self ):
    self.next_button.Enable( self.__next_enabled )
    if self.next_button.Enabled != self.__next_enabled:
        from threading import Timer
        Timer( 0.1, self.reset_button_states ).start()