rev |
line source |
martiran@18
|
1 import Tkinter as tk |
Alex@23
|
2 import tkFileDialog as tkfd |
martiran@20
|
3 import engine |
martiran@18
|
4 |
martiran@18
|
5 |
martiran@18
|
6 |
martiran@18
|
7 class UI(object): |
martiran@19
|
8 def __init__ (self): |
martiran@20
|
9 root = tk.Tk() |
martiran@20
|
10 root.title("Python Battle") |
martiran@20
|
11 self.canvas = tk.Canvas(root, background = "black") |
martiran@19
|
12 self.canvas.pack(side ="top", fill="both", expand="yes") |
martiran@20
|
13 buttons = tk.Frame(root) |
martiran@20
|
14 buttons.pack(side ="bottom", fill="both", expand="yes") |
martiran@20
|
15 self.buttons_pack(buttons) |
martiran@19
|
16 self.id = 0 |
martiran@19
|
17 self.engine = engine.Engine(self.canvas) |
martiran@18
|
18 return |
martiran@20
|
19 def buttons_pack(self, frame): |
Alex@23
|
20 load_1 = tk.Button(frame, text="Load", command=self.load(1)) |
martiran@20
|
21 load_1.pack(side="top", fill="both", expand = "yes") |
Alex@23
|
22 load_2 = tk.Button(frame, text="Load", command=self.load(2)) |
martiran@20
|
23 load_2.pack(side="top", fill="both", expand = "yes") |
martiran@20
|
24 run_b = tk.Button(frame, text="Run", command=self.run()) |
martiran@20
|
25 run_b.pack(side="top", fill="both", expand = "yes") |
Alex@23
|
26 load_3 = tk.Button(frame, text="Load", command=self.load(3)) |
martiran@20
|
27 load_3.pack(side="bottom", fill="both", expand = "yes") |
Alex@23
|
28 load_4 = tk.Button(frame, text="Load", command=self.load(4)) |
martiran@20
|
29 load_4.pack(side="bottom", fill="both", expand = "yes") |
martiran@20
|
30 step_b = tk.Button(frame, text="Step", command=self.step()) |
martiran@20
|
31 step_b.pack(side="bottom", fill="both", expand = "yes") |
martiran@20
|
32 return |
Alex@23
|
33 def load (self, snake_number): |
Alex@23
|
34 file_name = tkfd.askopenfilename(title="Open file") |
Alex@23
|
35 snake_file = open(file_name,'r') |
Alex@23
|
36 |
martiran@18
|
37 pass |
Alex@23
|
38 |
martiran@18
|
39 def run (self): |
Alex@23
|
40 |
martiran@18
|
41 pass |
martiran@18
|
42 def step (self): |
Alex@23
|
43 |
martiran@18
|
44 pass |
martiran@18
|
45 |