# first of all, check whether input is a non-negative int
if not control.get_text.isdigit():
print "Input a non-negative integer please!"
print
return None
文本框的内容都是字符串类型,不方便直接判断。以上代码实现了对于文本框内容是否为非负整数的判别。
# first of all, check whether input is a non-negative int
if not control.get_text.isdigit():
print "Input a non-negative integer please!"
print
return None