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

Commit e670a6a

Browse files
committed
Initial Animation classes
1 parent d7e8ab4 commit e670a6a

File tree

3 files changed

+65
-6
lines changed

3 files changed

+65
-6
lines changed

Pipfile.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import tkinter as tk
2+
3+
from .animate import Window
4+
5+
root = tk.Tk()
6+
7+
w = Window(root)
8+
w.pack()
9+
10+
tk.mainloop()

src/animate.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import tkinter as tk
2+
from enum import Flag
3+
from dataclasses import dataclass
4+
5+
from .coord import Coord
6+
7+
8+
class Direction(Flag):
9+
LEFT = Coord(-1, 0)
10+
RIGHT = Coord(1, 0)
11+
UP = Coord(0, 1)
12+
DOWN = Coord(0, -1)
13+
14+
15+
class Window(tk.Canvas):
16+
17+
events = []
18+
19+
def set_event(self, event: tk.EventType):
20+
self.bind(event, self.run)
21+
22+
def run(self, event):
23+
pass
24+
25+
26+
@dataclass
27+
class Motion:
28+
29+
canvas: tk.Canvas
30+
direction: Direction
31+
speed: int
32+
33+
frames = 30
34+
35+
36+
37+
38+
39+
40+
class Animate:
41+
42+
def __init__(self, obj: tk.Widget):
43+
self.obj = obj
44+
45+
def set_event(self, event: tk.EventType):
46+
self.bind(event, self.run)
47+
48+
def add(self, )
49+

0 commit comments

Comments
 (0)