开发者

wxPython validator not called for grandchild of dialogue

I have something like this:

class ADialog(wx.Dialog):
    def __init__(self, parent, *args, **kwargs):
        ...
        self.editor = APanel(parent=self)
        ...
    ...

class APanel(wx.Panel):
    def CreatePanel(self, *args, **kwargs):
        ...
        self.textCtr开发者_开发知识库ls = []
        for (key, val) in zip(foo, bar):
            ...
            box = wx.TextCtrl(parent=self, value=val, validator=Validator())
            ....

Now, I need to have APanel seperate, because the text controls have to be changed dynamically.

Problem is, the Validate() method of Validator never gets called.

I've tried passing the flag wx.WS_EX_VALIDATE_RECURSIVELY to wx.Dialog.__init__, and also tried overriding the Validate() method of ADialog to call Validate() on APanel, and then overridden the Validate() method of APanel to call the validators of each text control, but that didn't work either.

os: Windows 7

python version: 2.5.4

wxPython version: 2.8.10


wx.WS_EX_VALIDATE_RECURSIVELY is an extended style, so you need to set it with SetExtraStyle, not by passing it to the base class' __init__

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜