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
3 class Handlers(object):
5 def __init__(self, scale, speed, offset_x, offset_y):
8 self.offset_x = offset_x
9 self.offset_y = offset_y
14 self.after_id = canvas.after(self.speed, self.start)
17 self.canvas.after_cancel(self.after_id)
52 def press1():# ?????????
55 def motion1():# ?????????
58 def press3():# ?????????
61 def motion3():# ?????????
64 def press_key1():# ?????????+??????????? ?? ???? (?????+ctrl)
67 def motion_key1():# ?????????+??????????? ?? ???? (?????+ctrl)
76 def change_states():# ????????? ?????? ??? ????????? ??????? ?????????: ?????? ??????????, ????? ??????? ???? ??? ??? ? ???? ??? ??????: toTop toBottom switch delete
79 def to_top():# ?????????? ???? ??????? ?????? ? ??????
82 def to_bottom():# ?????????? ???? ??????? ?????? ? ?????
85 def switch():# ?????? ??? ????????? ???????? ???????
91 def close_change_window():# ????????? ???? ????????? ??????? ?????????
94 def add_state():# ???????? ?????? ??????????, ??? ??????: add close
100 def close_add_window():
103 def change_state_parameters():# ????????? ??????, ? ??????? ???? ?????? ?????????, ??????? ????? ?????? ? ?????????, ??????? ??????????????? ??? ????????? ????????? ??????, ???? ?????? OK close delete
108 #deleteState ??? ????
110 def close_state_window():
114 frame1.pack(side="right", fill="y", expand="no", before=canvas)
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)
131 frame1=Frame(root, background="grey")
132 statelist=Listbox(frame1, selectmode="extended")
134 statelist.insert("end", state)
135 statelist.pack(side="top", fill="y")
136 up = Button(frame1, text="Up", state="disable")
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")
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")