Changes in main.py [26:a29fb8b305d7:25:2881ede732a7]
Legend:
- Unmodified
- Added
- Removed
-
main.py
r26 r25 ˆà 3 3 import engineˆà 4 4 ˆà ˆà 5 class UI(object):ˆà 5 6 ˆà 6 ˆà ˆà7 ˆà class UI(object):ˆà8 7 def __init__ (self):ˆà 9 8 root = tk.Tk()ˆà òÀæ òÀæ ˆà 11 10 self.canvas = tk.Canvas(root, background = "black")ˆà 12 11 self.canvas.pack(side ="top", fill="both", expand="yes")ˆà 13 ˆà buttons = tk.Frame(root)ˆàˆà 12 buttons = self.create_buttons(root)ˆà 14 13 buttons.pack(side ="bottom", fill="both", expand="yes")ˆà 15 ˆà self.buttons_pack(buttons)ˆà16 14 self.id = 0ˆà 17 15 self.engine = engine.Engine(self.canvas)ˆà 18 16 returnˆà 19 ˆà def buttons_pack(self, frame):ˆà ˆà 17 ˆà ˆà 18 def create_buttons(self, root):ˆà ˆà 19 frame = tk.Frame(root)ˆà 20 20 load_1 = tk.Button(frame, text="Load", command=self.load(1))ˆà 21 21 load_1.pack(side="top", fill="both", expand = "yes")ˆà òÀæ òÀæ ˆà 30 30 step_b = tk.Button(frame, text="Step", command=self.step())ˆà 31 31 step_b.pack(side="bottom", fill="both", expand = "yes")ˆà 32 ˆà returnˆà ˆà 32 return frameˆà ˆà 33 ˆà 33 34 def load (self, snake_number):ˆà 34 35 file_name = tkfd.askopenfilename(title="Open file")ˆà 35 36 snake_file = open(file_name,'r')ˆà 36 ˆà ˆà ˆà 37 ˆà ˆà 38 def run (self):ˆà 37 39 passˆà 38 40 ˆà 39 ˆà def run (self):ˆà ˆà 41 def step (self):ˆà ˆà 42 passˆà 40 43 ˆà 41 ˆà passˆà42 ˆà def step (self):ˆà43 ˆà ˆà44 ˆà passˆà45 ˆà
Note: See TracChangeset
for help on using the changeset viewer.