wx.TextCtrl and wx.Validator

后端 未结 4 1853
清歌不尽
清歌不尽 2020-12-10 07:49

I need to validate the textboxes with wx.Textvalidator. Any please help me to do this?

How can i use wx.FILTER_ALPHA with validators and if the user is giving a wron

4条回答
  •  爱一瞬间的悲伤
    2020-12-10 08:33

    I was unable to make the sample code work properly within my code (not using a dialog at all but a txtctrl within a panel), even though it works correctly in the demo (go figure).

    I ended up using a snippet from another site and feel obligated to document it here:

    self.tc.GetValidator().Validate(self.tc)
    

    This was the only way that I could get my custom validator code to be called. Calling self.tc.Validate() did not work at all nor did self.Validate(), nor either representation passing the window in as a parameter.

    reference: link text

提交回复
热议问题