# create 'dragbug' with a pure tkinter program # DRAG AROUND THE RED SQUARE AS FAST AS POSSIBLE # AND THE PROGRAM WILL CRASH AFTER A VIEW SECONDS, # DISPLAYING: """Runtime ERror! Program C:\Python31\pythonw.exe This application has requested the Runtime to terminate it in an unsusual way. Please contakt the application's support team for more information. """ # IF STARTED FROM WITHIN IDLE, IDLE CLOSES IMMEDIATELY # IF STARTED FROM A COMMAND_LINE (UNDER WINDOWS): """ Fatal Python error: Cannot recover from stack overflow. """ REPETITIONS = 5 # The larger REPETITIONS, the earlier occurs the crash from tkinter import * root = Tk() cv = Canvas(width=800, height=800, background="white") cv.pack() r = cv.create_rectangle(390, 390, 410, 410, fill="red") l = cv.create_line(400, 400, 400, 400, fill="blue") def move(event): x, y = event.x, event.y ## print(x,y) cv.coords(r, x-10, y-10, x+10, y+10) cl = list(cv.coords(l)) for i in range(REPETITIONS): cl.extend([x, y]) cv.coords(l, *cl) cv.update() cv.tag_bind(r, "", move) root.mainloop()