如何将我的计时器代码放入tkinter图形网格中?

时间:2018-11-27 23:43:46

标签: python python-3.x tkinter

我有以下计时器代码:

import tkinter as tk


def update_timeText():
    if (state):
        global timer
        timer[2] += 1
    if (timer[2] >= 100):
        timer[2] = 0
        timer[1] += 1
    if (timer[1] >= 60):
        timer[0] += 1
        timer[1] = 0
    timeString = pattern.format(timer[0], timer[1], timer[2])
    timeText.configure(text=timeString)
    root.after(10, update_timeText)

def start():
    global state
    state = True

state = False
root = tk.Tk()
root.wm_title('Simple Kitchen Timer Example')

timer = [0, 0, 0]
pattern = '{0:02d}:{1:02d}:{2:02d}'

timeText = tk.Label(root, text="00:00:00", font=("Helvetica", 150))
timeText.pack()

startButton = tk.Button(root, text='Start', command=start)
startButton.pack()


update_timeText()
root.mainloop()

我想知道如何将其放在我制作的这个盒子中,该盒子在IDLE的火箭应用程序的图形窗口中打开。

moveTo(611,300)
drawLine(0,60)
moveTo(611,300)
drawLine(128,0)
moveTo(739,300)
drawLine(0,60)
moveTo(611,360)
drawLine(128,0)
moveTo(675,320)
drawText('Time:')

0 个答案:

没有答案