Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/snake/annotate/876720141659/main.py
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 19:04:50 2014
Кодировка:
snake: main.py annotate

snake

annotate main.py @ 24:876720141659

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