Changeset 20:37e8bca3ae66
- Timestamp:
- 12/16/10 01:35:46 (5 years ago)
- Branch:
- default
- Children:
- 21:000c22d7b89c, 23:6189d0cecd2d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main.py
r19 r20 ˆà 1 1 import Tkinter as tkˆà ˆà 2 import engineˆà 2 3 ˆà 3 4 ˆà òÀæ òÀæ ˆà 5 6 class UI(object):ˆà 6 7 def __init__ (self):ˆà 7 ˆà self.root = tk.Tk()ˆà8 ˆà self.root.title("Python Battle")ˆà9 ˆà self.canvas = tk.Canvas( self.root, background = "black")ˆàˆà 8 root = tk.Tk()ˆà ˆà 9 root.title("Python Battle")ˆà ˆà 10 self.canvas = tk.Canvas(root, background = "black")ˆà 10 11 self.canvas.pack(side ="top", fill="both", expand="yes")ˆà 11 ˆà self.buttons = tk.Frame(self.root)ˆà 12 ˆà self.buttons.pack(side ="bottom", fill="both", expand="yes")ˆà 13 ˆà self.load_1 = tk.Button(self.buttons, text="Load")ˆà 14 ˆà self.load_2 = tk.Button(self.buttons, text="Load")ˆà 15 ˆà self.load_3 = tk.Button(self.buttons, text="Load")ˆà 16 ˆà self.load_4 = tk.Button(self.buttons, text="Load")ˆà 17 ˆà self.run_b = tk.Button(self.buttons, text="Run")ˆà 18 ˆà self.step_b = tk.Button(self.buttons, text="Step")ˆà 19 ˆà # .......ˆà ˆà 12 buttons = tk.Frame(root)ˆà ˆà 13 buttons.pack(side ="bottom", fill="both", expand="yes")ˆà ˆà 14 self.buttons_pack(buttons)ˆà 20 15 self.id = 0ˆà 21 16 self.engine = engine.Engine(self.canvas)ˆà ˆà 17 returnˆà ˆà 18 def buttons_pack(self, frame):ˆà ˆà 19 load_1 = tk.Button(frame, text="Load", command=self.load_1())ˆà ˆà 20 load_1.pack(side="top", fill="both", expand = "yes")ˆà ˆà 21 load_2 = tk.Button(frame, text="Load", command=self.load_2())ˆà ˆà 22 load_2.pack(side="top", fill="both", expand = "yes")ˆà ˆà 23 run_b = tk.Button(frame, text="Run", command=self.run())ˆà ˆà 24 run_b.pack(side="top", fill="both", expand = "yes")ˆà ˆà 25 load_3 = tk.Button(frame, text="Load", command=self.load_3())ˆà ˆà 26 load_3.pack(side="bottom", fill="both", expand = "yes")ˆà ˆà 27 load_4 = tk.Button(frame, text="Load", command=self.load_4())ˆà ˆà 28 load_4.pack(side="bottom", fill="both", expand = "yes")ˆà ˆà 29 step_b = tk.Button(frame, text="Step", command=self.step())ˆà ˆà 30 step_b.pack(side="bottom", fill="both", expand = "yes")ˆà 22 31 returnˆà 23 32 def load (self):ˆà
Note: See TracChangeset
for help on using the changeset viewer.