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

snake

annotate main.py @ 25:2881ede732a7

import tkFileDialog as tkfd
author Alex Martynov
date Sat, 18 Dec 2010 20:12:19 +0300
parents 876720141659
children a29fb8b305d7
rev   line source
martiran@18 1 import Tkinter as tk
Alex@25 2 import tkFileDialog as tkfd
martiran@20 3 import engine
martiran@18 4
me@22 5 class UI(object):
martiran@18 6
martiran@19 7 def __init__ (self):
martiran@20 8 root = tk.Tk()
martiran@20 9 root.title("Python Battle")
martiran@20 10 self.canvas = tk.Canvas(root, background = "black")
martiran@19 11 self.canvas.pack(side ="top", fill="both", expand="yes")
me@21 12 buttons = self.create_buttons(root)
martiran@20 13 buttons.pack(side ="bottom", fill="both", expand="yes")
martiran@19 14 self.id = 0
martiran@19 15 self.engine = engine.Engine(self.canvas)
martiran@18 16 return
me@22 17
me@21 18 def create_buttons(self, root):
me@21 19 frame = tk.Frame(root)
Alex@24 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@24 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@24 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@24 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")
me@21 32 return frame
me@22 33
Alex@24 34 def load (self, snake_number):
Alex@24 35 file_name = tkfd.askopenfilename(title="Open file")
Alex@24 36 snake_file = open(file_name,'r')
me@22 37
martiran@18 38 def run (self):
martiran@18 39 pass
me@22 40
martiran@18 41 def step (self):
martiran@18 42 pass
me@22 43