[Tkinter] Canvas animation - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Canvas animation (/thread-26600.html) |
Canvas animation - stephboo - May-06-2020 I've been working on a simple tkinter app that has various widgets, I've done some entries, a button, some radiobuttons and so on...all I have left is to make an animation in canvas. I make the arc, but I don't know how to do animations on it. The animation should start automatically when the code is run and keep going until a certain radio button is selected and a button pressed, when I press the button it should do a backward-animation and stop. To be more specific - there is only one button that does different things based on which radio button is selected. Here is the video of how the animation should look: https://streamable.com/7w2dxe Here is the code: c = tkinter.Canvas(root, bg='yellow', height=150, width=300) coord = 60, 60, 240, 210 arc = c.create_arc(coord, start=0, extent=180, fill='red') c.pack(expand=True, fill='both') stop_anim = Radiobutton(root, text='STOP ANIMATION', variable=var, value=2).pack(anchor=W) do_it_button = Button(root, text='DO IT!', bg='limegreen', command=functions).pack(expand=True, fill='both')I made the arc (to almost match the one on the video), but I can't seem to make that line do the animation and then stop on a click of the button. Any help will be appreciated! RE: Canvas animation - Larz60+ - May-06-2020 This will get you started: http://effbot.org/zone/tkinter-animation.htm |