当前位置:首页 / 文章测试 / 001

001

开始打字练习

lb=Text(root)

lb.place(x=20,y=160,width=200,height=200)

lb.tag_config('样式1', foreground='red')

lb.tag_config('样式2', foreground='black')

lb.tag_config('样式3', foreground='black',background="yellow")

def guess():

lb.config(state=NORMAL)

a=enternumber.get()

if a=="":

lb.insert(END,"不能为空!\n","样式1")

elif not a.isdigit():

lb.insert(END,"必须是数字!\n","样式1")

elif eval(a)<0 or eval(a)>100:

lb.insert(END,"不能小于0或者大于100!\n","样式1")

elif 0<=eval(a)<20:

lb.insert(END,"太小了!\n","样式2")

elif 20<eval(a)<=100:

lb.insert(END,"太大了!\n","样式2")

elif eval(a)==20:

lb.insert(END,"猜对了!\n","样式3")

def clear():

enternumber.delete(0,END)

lb.delete(0,END)

lb.config(state=DISABLED)

声明:以上文章均为用户自行发布,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。

本文打字速度TOP10

  • 暂无打字数据!