Python Forum

Full Version: Canvas animation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!