Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit 30e7ef9

Browse files
committed
Fixed animations not completing all the way
1 parent d4e62a5 commit 30e7ef9

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/animate.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,25 @@ def start(self) -> Generator[Callable]:
213213
"""
214214
move = partial(self.canvas.move, self.id)
215215

216-
def frame(increment: Coord, count: int):
216+
def frame(increment: Coord, count: int = 1):
217217
for _ in range(count):
218218
move(*increment)
219219
self.canvas.master.update_idletasks()
220220

221221
for end in self.endpoints:
222-
start = Coord(*self.canvas.coords(self.id)[:2])
222+
start = self.current
223223
steps = round(start.distance(end) / self.speed)
224224
frames = round(steps / self.speed)
225225
increment = (end - start) / steps
226226

227227
for _ in range(frames):
228228
yield partial(frame, increment, round(steps / frames))
229+
buffer = end - self.current
230+
yield partial(frame, buffer)
231+
232+
@property
233+
def current(self):
234+
return Coord(*self.canvas.coords(self.id)[:2])
229235

230236
def __iter__(self):
231237
return self.start()

src/front.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def init(self):
7272

7373
self.cache = ImageCache(self.cachesize)
7474
self.cache.start()
75+
self.after(0, self.__next)
7576

7677
def cmd_dislike(self):
7778
self.__next('left')
@@ -110,3 +111,10 @@ def load(self, data: dict):
110111
for name, val in data.items():
111112
item = self.__make_item(name, val)
112113
item.pack(expand=True, fill='x')
114+
115+
116+
class Splash(widget.PrimaryFrame):
117+
118+
def init(self):
119+
self.window = Window(self)
120+

0 commit comments

Comments
 (0)