from sprites import Screen,Spinbox,StringVar
def show_demo():
n = spinval.get()
screen.title(n)
screen = Screen()
screen.setup(800,600)
screen.xy_grid()
spinval = StringVar()
sp = Spinbox(350,140,textvariable=spinval,font=('黑体',12,'normal'),
command=show_demo,width=10,from_=3, to=72)
# 绑定回车,敲回车也会调用show_demo函数
sp.bind("",lambda event:show_demo() )
screen.mainloop()
|