N
N
Nick V2014-11-07 16:12:03
Python
Nick V, 2014-11-07 16:12:03

How to make an animation move in tkinter?

Issue resolved.
coord() function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
throughtheether, 2014-11-07
@throughtheether

I will assume that you do not observe animations due to the fact that the coordinates of the centers of the pendulums practically do not change for you (the integer part is constant). I think it's in the final_calculations function. Can you show her code?
UPD : in this code, of course, everything is fine. The error, I think, lies here (see the comment on the last line):

i = 0
...
class Pendulum(object):
    def __init__(self):
        ...
        self.root.after(0, self.animation, i)
    def animation(self, i):
        i = i # полагаю, i всегда равно 0

I propose to fix it like this (not the best way, but it involves minimal changes in the code):
i = 0
...
class Pendulum(object):
    def __init__(self):
        ...
        self.root.after(0, self.animation)
    def animation(self):
        global i

However, taking into account, to put it mildly, the extraordinary structure of the code, it may be necessary to correct the text of the program in some more places.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question