Python GUI更新有问题吗 导入系统 导入时间 从tkinter进口* 从tkinter导入消息框 Gui=Tk() 标题(“练习计时器”) def jesse(德尔普): x=derp 测试=0 而x>=0和x

Python GUI更新有问题吗 导入系统 导入时间 从tkinter进口* 从tkinter导入消息框 Gui=Tk() 标题(“练习计时器”) def jesse(德尔普): x=derp 测试=0 而x>=0和x,python,user-interface,tkinter,python-idle,Python,User Interface,Tkinter,Python Idle,” 导入系统 导入时间 从Tkinter进口* 导入tkMessageBox Gui=Tk() 标题(“练习计时器”) def jesse(德尔普): x=derp 测试=0 而x>=0和x import sys import time from tkinter import * from tkinter import messagebox Gui = Tk() Gui.title("Exercise Timer") def jesse(derp): x=derp test

导入系统 导入时间 从Tkinter进口* 导入tkMessageBox Gui=Tk() 标题(“练习计时器”) def jesse(德尔普): x=derp 测试=0 而x>=0和x
import sys
import time
from tkinter import *
from tkinter import messagebox

Gui = Tk()
Gui.title("Exercise Timer")

def jesse(derp):
    x=derp
    test = 0
    while x>=0 and x<=derp:
        if test == 0:
            Gui.after(1000,makeLabel(x))
            x= x-1
            if x==0:
                test = 1
        if test == 1:
            if x == 0:
                Gui.after(1000,makeLabel("brk pls"))
                x=x+1
            else:    
                Gui.after(1000,makeLabel(x))
                x=x+1

def makeLabel(texts):
    Gui.update()
    newlab = Label(text=texts).pack()

def stop():
    Gui.destroy()

mbutton = Button(text="10 seconds",command = lambda: jesse(10)).pack()
mbutton = Button(text="20 seconds",command = lambda: jesse(20)).pack()
mbutton = Button(text="30 seconds",command = lambda: jesse(30)).pack()
mbutton = Button(text="quit",fg="red",command = lambda: stop()).pack()

Gui.mainloop()
sys.exit()
import sys
import time
from Tkinter import *
import tkMessageBox

Gui = Tk()
Gui.title("Exercise Timer")

def jesse(derp):
    x=derp
    test = 0
    while x>=0 and x<=derp:
        if test == 0:
            Gui.after(1000,makeLabel(x))
            x= x-1
            if x==0:
                test = 1
        if test == 1:
            if x == 0:
                Gui.after(1000,makeLabel("brk pls"))
                x=x+1
            else:    
                Gui.after(1000,makeLabel(x))
                x=x+1

def makeLabel(texts):
    try:
        Gui.update()
        newlab = Label(text=texts).pack()
    except TclError:
        pass

def stop():
    Gui.destroy()

mbutton = Button(text="10 seconds",command = lambda: jesse(10)).pack()
mbutton = Button(text="20 seconds",command = lambda: jesse(20)).pack()
mbutton = Button(text="30 seconds",command = lambda: jesse(30)).pack()
mbutton = Button(text="quit",fg="red",command = lambda: stop()).pack()

Gui.mainloop()
sys.exit()