Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/cca/file/721fdbb815c8/Interface.py
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 18:15:01 2014
Кодировка:
cca: 721fdbb815c8 Interface.py

cca

view Interface.py @ 6:721fdbb815c8

basic structure of interface
author Ilia
date Fri, 03 Dec 2010 23:05:02 +0300
parents 9194e2a2e45c
children e56a5e838f37
line source
1 from Tkinter import *
3 class Handlers(object):
5 def __init__(self, scale, speed, offset_x, offset_y):
6 self.scale = scale
7 self.speed = speed
8 self.offset_x = offset_x
9 self.offset_y = offset_y
10 self.after_id = 0
12 def start(self):
13 self.nextStep()
14 self.after_id = canvas.after(self.speed, self.start)
16 def stop(self):
17 self.canvas.after_cancel(self.after_id)
19 def next_step(self):
20 automata.nextStep()
21 self.draw()
23 def save_file():
24 pass
26 def open_file():
27 pass
29 def help():
30 pass
32 def close_help_window
34 def zoom_in():
35 pass
37 def zoom_out():
38 pass
40 def slower():
41 pass
43 def faster():
44 pass
46 def change_size():
47 pass
49 def draw():
50 pass
52 def press1():# ?????????
53 pass
55 def motion1():# ?????????
56 pass
58 def press3():# ?????????
59 pass
61 def motion3():# ?????????
62 pass
64 def press_key1():# ?????????+??????????? ?? ???? (?????+ctrl)
65 pass
67 def motion_key1():# ?????????+??????????? ?? ???? (?????+ctrl)
68 pass
70 def press12():# zoom
71 pass
73 def motion12():# zoom
74 pass
76 def change_states():# ????????? ?????? ??? ????????? ??????? ?????????: ?????? ??????????, ????? ??????? ???? ??? ??? ? ???? ??? ??????: toTop toBottom switch delete
77 pass
79 def to_top():# ?????????? ???? ??????? ?????? ? ??????
80 pass
82 def to_bottom():# ?????????? ???? ??????? ?????? ? ?????
83 pass
85 def switch():# ?????? ??? ????????? ???????? ???????
86 pass
88 def delete_state():
89 pass
91 def close_change_window():# ????????? ???? ????????? ??????? ?????????
92 pass
94 def add_state():# ???????? ?????? ??????????, ??? ??????: add close
95 pass
97 def add():
98 pass
100 def close_add_window():
101 pass
103 def change_state_parameters():# ????????? ??????, ? ??????? ???? ?????? ?????????, ??????? ????? ?????? ? ?????????, ??????? ??????????????? ??? ????????? ????????? ??????, ???? ?????? OK close delete
104 pass
106 def ok():
107 pass
108 #deleteState ??? ????
110 def close_state_window():
111 pass
113 def show_frame():
114 frame1.pack(side="right", fill="y", expand="no", before=canvas)
117 root = Tk()
118 root.title("Cyclyc Cell Automata")
120 canvas = Canvas(root, background="white")
121 canvas.config(width=500, height=400)
122 canvas.pack(fill="both", expand="yes")
124 automata = Automata()
125 handlers = Handlers(1, 1, 0, 0)
127 states = []
128 symboles = dict()
130 #infoPanel=Frame
131 frame1=Frame(root, background="grey")
132 statelist=Listbox(frame1, selectmode="extended")
133 for state in states:
134 statelist.insert("end", state)
135 statelist.pack(side="top", fill="y")
136 up = Button(frame1, text="Up", state="disable")
137 up.config(bg="red")
138 down = Button(frame1, text="Down", state="disable")
139 down.config(bg="orange")
140 to_top = Button(frame1, text="To Top", state="disable")
141 to_top.config(bg="yellow")
142 to_bottom = Button(frame1, text="To Bottom", state="disable")
143 to_bottom.config(bg="green")
144 hide = Button(frame1, text="hide", command=frame1.forget)
145 hide.config(bg="cyan")
146 up.pack(side="top", fill="x")
147 down.pack(side="top", fill="x")
148 to_top.pack(side="top", fill="x")
149 to_bottom.pack(side="top", fill="x")
150 hide.pack(side="bottom", fill="x")
153 menubar = Menu(root)
154 root.config(menu=menubar)
156 menu_file = Menu(menubar)
157 menu_file.add_command(label="New")
158 menu_file.add_command(label="Open...")
159 menu_file.add_command(label="Save...")
160 menu_file.add_separator()
161 menu_file.add_command(label="Exit")
162 menubar.add_cascade(label="File", menu=menu_file)
164 menu_action = Menu(menubar)
165 menu_action.add_command(label="Start")
166 menu_action.add_command(label="Stop")
167 menu_action.add_command(label="Next Step")
168 menu_action.add_command(label="Increase speed")
169 menu_action.add_command(label="Decrease speed")
170 menu_action.add_command(label="Zoom In")
171 menu_action.add_command(label="Zoom Out")
172 menu_action.add_command(label="Clean field")
173 menu_action.add_command(label="Fill randomly")
174 menubar.add_cascade(label="Action", menu=menu_action)
176 menubar.add_command(label="Automata", command=handlers.show_frame)
178 menubar.add_command(label="Help")
180 root.mainloop()