0
내가 무엇입니까 다음과 같은 오류 :_tkinter.TclError : 잘못된 명령 이름은 "0.14574424"
_tkinter.TclError: invalid command name “.14574424”
나는 오류를 이해할 수 없습니다입니다. 내가 도대체 뭘 잘못하고있는 겁니까?
# Import tkinter
from tkinter import *
class AnimationDemo:
def __init__(self):
window = Tk() # Create a window
window.title("Animation Demo") # Set a title
width = 250 # Width of the canvas
canvas = Canvas(window, bg = "white", width = 250, height = 50)
canvas.pack()
x = 0 # Starting x position
canvas.create_text(x, 30, text = "Message moving?", tags = "text")
dx = 3
while True:
canvas.move("text", dx, 0) # Move text dx unit
canvas.after(100) # Sleep for 100 milliseconds
canvas.update() # Update canvas
if x < width:
x += dx # Get the current position for string
else:
x = 0 # Reset string position to the beginning
canvas.delete("text")
# Redraw text at the beginning
canvas.create_text(x, 30, text = "Message moving?", tags = "text")
window.mainloop() # Create an event loop
AnimationDemo() # Create GUI
오류 : 역 추적 (가장 최근 통화 최종) : 파일 "D를 : /sem4/t/lesson4/task1/task.py ", 줄 29, AnimationDemo() # GUI 작성 파일"D : /sem4/t/lesson4/task1/task.py "17 번째 줄 __init__ canvas.move ("text", dx, 0) # 텍스트 DX 단위 이동 F ile "C : \ Users \ sreeyu \ AppData \ Local \ Programs \ Python \ Python35 \ lib \ tkinter \ __init__.py"(이동 2431) self.tk.call ((self._w, 'move') + args) _tkinter.TclError : 잘못된 명령 이름 ".14440096" –
hss
그 원인은 무엇입니까? 그런데 Tkinter로 애니메이션을 만드는 것은 잘못된 방법입니다. http://stackoverflow.com/a/11505034/7432 –
을 참조하십시오 감사합니다 @ BryanOakley하지만 내가 pls 우리가 루프를 사용하는 경우 오류를 보여주는 이유를 알 수 있습니다 – hss