[wxpython2.7]"Could not transfer data to window "警告

今天在wxPython2.7中实现了一个继承自wx.PyValidator 的判断是否是数字的validator,用于TectCtrl中。代码编写好后,在每次运行时会弹出个对话框,提示warning "Could not transfer data to window ", 但功能运行是正常的。
在百度上按全句匹配搜了一下,没有结果。在google中就搜出来了几个,看来还是google实力强些。但是google搜出的结果也没回答到要点上。
后来执行看了一下wxpython demo中的代码,发现在TextObjectValidator中实现了如下几个函数,说是防止wxDialog抱怨的,照样试了一下,果真解决了问题。另外,在Panel中用的validator不需要添加这几个函数。
def  TransferToWindow(self):
         
"""  Transfer data from validator to window.

             The default implementation returns False, indicating that an error
             occurred.  We simply return True, as we don't do any data transfer.
         
"""
         
return  True  #  Prevent wxDialog from complaining.


     
def  TransferFromWindow(self):
         
"""  Transfer data from window to validator.

             The default implementation returns False, indicating that an error
             occurred.  We simply return True, as we don't do any data transfer.
         
"""
         
return  True  #  Prevent wxDialog from complaining.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值