(Python GUI)跟随六边形时会忽略两条指令

时间:2017-04-06 12:28:38

标签: python user-interface tkinter tkinter-canvas

当我运行代码时,遵循六边形时忽略[TKUptake(0,-5,-5)TKUptake(0,5,-5)]。有什么问题?

import time
from tkinter import *

tk = Tk()
canvas = Canvas(tk, width=1000, height=1000, background="black")
canvas.pack()
canvas.create_polygon(300, 200, 300, 250, 340, 225, fill="yellow")


def TKUptake(x, y, z):
    for i in range(0, 20):
        canvas.move(x, y, z)
        tk.update()
        time.sleep(0.03)


k = int(input("input value\n"))
for q in range(0, k):
    TKUptake(1, 5, 0)
    TKUptake(1, 5, 5)
    TKUptake(1,-5, 5)
    TKUptake(1,-5, 0)
    TKUptake(0,-5,-5)
    TKUptake(0, 5,-5)

0 个答案:

没有答案