我写了一个程序,将六边形形状移动了多次 第8行有一个错误,但我问你另一行是否有任何错误,
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(CanvasMove(x),CanvasMove(y),CanvasMove(z)):
for x in range(0, 20):
canvas.move(CanvasMove(x),CanvasMove(y),CanvasMove(z))
tk.update()
time.sleep(0.03)
k = int(input("input value"))
for q in range(0,k):
TKUptake(1,5,5)
TKUptake(1,5,5)
TKUptake(1,-5,5)
TKUptake(1,-5,0)
TKUptake(0,-5,-5)
TKUptake(0,5,-5)
答案 0 :(得分:0)
第8行有缩进错误,请使用以下
进行修复def TKUptake(CanvasMove(x),CanvasMove(y),CanvasMove(z)):
for x in range(0, 20):
canvas.move(CanvasMove(x),CanvasMove(y),CanvasMove(z))
tk.update()
time.sleep(0.03)