Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/snake/raw-rev/3619305694ad
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 07:26:50 2012
Кодировка:

# HG changeset patch
# User Danya Alexeyevsky
# Date 1292801195 -10800
# Node ID 3619305694ad0e54c71cfdd53f477ce8f80ba962
# Parent dcd9d23e77d72043f345730d6203ca52db09bb94
Actually fixed buttons resizing. Fixed code separation for buttons drawing.

diff -r dcd9d23e77d7 -r 3619305694ad main.py
--- a/main.py Mon Dec 20 02:23:01 2010 +0300
+++ b/main.py Mon Dec 20 02:26:35 2010 +0300
@@ -11,27 +11,26 @@
self.root.title("Python Battle")
self.canvas = tk.Canvas(self.root, background = "black")
self.canvas.pack(side ="top", fill="both", expand="yes")
- buttons = tk.Frame(self.root)
- buttons.pack(side ="bottom", fill="both", expand="yes")
- self.buttons_pack(buttons)
+ self.buttons_pack(self.root).pack(side ="bottom", fill="both", expand="no")
self.step_id = 0
self.engine = engine.Engine(self.canvas)
self.after_id = None
return
- def buttons_pack(self, frame):
- load_1 = tk.Button(frame, text="Load 1", command=lambda: self.load(1))
- load_1.pack(side="left", fill="both", expand = "no")
- load_2 = tk.Button(frame, text="Load 2", command=lambda: self.load(2))
- load_2.pack(side="left", fill="both", expand = "no")
- run_b = tk.Button(frame, text="Run", command=lambda: self.run())
- run_b.pack(side="left", fill="both", expand = "no")
- load_3 = tk.Button(frame, text="Load 3", command=lambda: self.load(3))
- load_3.pack(side="right", fill="both", expand = "no")
- load_4 = tk.Button(frame, text="Load 4", command=lambda: self.load(4))
- load_4.pack(side="right", fill="both", expand = "no")
- step_b = tk.Button(frame, text="Step", command=lambda: self.step())
- step_b.pack(side="right", fill="both", expand = "no")
- return
+ def buttons_pack(self, root):
+ buttons = tk.Frame(root)
+ load_1 = tk.Button(buttons, text="Load 1", command=lambda: self.load(1))
+ load_1.pack(side="left", fill="both", expand = "yes")
+ load_2 = tk.Button(buttons, text="Load 2", command=lambda: self.load(2))
+ load_2.pack(side="left", fill="both", expand = "yes")
+ run_b = tk.Button(buttons, text="Run", command=lambda: self.run())
+ run_b.pack(side="left", fill="both", expand = "yes")
+ load_3 = tk.Button(buttons, text="Load 3", command=lambda: self.load(3))
+ load_3.pack(side="right", fill="both", expand = "yes")
+ load_4 = tk.Button(buttons, text="Load 4", command=lambda: self.load(4))
+ load_4.pack(side="right", fill="both", expand = "yes")
+ step_b = tk.Button(buttons, text="Step", command=lambda: self.step())
+ step_b.pack(side="right", fill="both", expand = "yes")
+ return buttons

def load (self, snake_number):
if self.step_id >= 200: