Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/cca/raw-rev/1107500c639b
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 04:30:11 2012
Кодировка:

# HG changeset patch
# User Ilia
# Date 1291549639 -10800
# Node ID 1107500c639b8ff18cfb613b2037be90d2aa959c
# Parent 992d0179053eddf56070c939f42e0395e8cb9cdc
binding of events

diff -r 992d0179053e -r 1107500c639b Interface.py
--- a/Interface.py Sun Dec 05 13:12:50 2010 +0300
+++ b/Interface.py Sun Dec 05 14:47:19 2010 +0300
@@ -247,14 +247,24 @@


root = Tk()
-root.title("Cyclyc Cell Automata")
+root.title("Cyclic Cellular Automata")

canvas = Canvas(root, background="white")
canvas.config(width=500, height=400)
-canvas.pack(fill="both", expand="yes")

automata = Automata(50, 50)
-handlers = Handlers(1, 1, 0, 0)
+handlers = Handlers()
+
+canvas.bind("<1>", handlers.press1)
+canvas.bind("", handlers.motion1)
+canvas.bind("<3>", handlers.press3)
+canvas.bind("", handlers.motion3)
+canvas.bind("", handlers.press1_key)
+canvas.bind("", handlers.motion1_key)
+canvas.bind("", handlers.press1_ctrl)
+canvas.bind("", handlers.motion1_ctrl)
+
+canvas.pack(fill="both", expand="yes")

states = []
symboles = dict()
@@ -272,7 +282,7 @@

Label(automata_frame, text= "State Box:").pack(side="top", fill="x")
state_list=Listbox(automata_frame, selectmode="extended")
-for state in states:
+for state in automata.states:
state_list.insert("end", state)
state_list.pack(side="top", fill="y")
up = Button(automata_frame, text="Up", state="disabled")
@@ -310,42 +320,43 @@
info_frame.pack(side="top")


-check_box = [0, 0, 0, 0, 0, 0, 0, 0, 0]
+ckeckbox_nums = [IntVar(), IntVar(), IntVar(), IntVar(), IntVar(),
+ IntVar(), IntVar(), IntVar(), IntVar()]

condition = Label(automata_frame, text= "Condition of conversion")
condition.pack(side="top", fill="x")
condition_frame=Frame(automata_frame, background="white")
Label(condition_frame, text="0: ").grid(row=0, column=0)
-c_box_0 = Checkbutton(condition_frame, variable = check_box[0], onvalue = 1, offvalue = 0)
-c_box_0.grid(row=0, column=1)
+c_button_0 = Checkbutton(condition_frame, variable=check_box[0])
+c_button_0.grid(row=0, column=1)
Label(condition_frame, text="1: ").grid(row=0, column=2)
-c_box_1 = Checkbutton(condition_frame, variable = check_box[1], onvalue = 1, offvalue = 0)
-c_box_1.grid(row=0, column=3)
+c_button_1 = Checkbutton(condition_frame, variable=check_box[1])
+c_button_1.grid(row=0, column=3)
Label(condition_frame, text="2: ").grid(row=0, column=4)
-c_box_2 = Checkbutton(condition_frame, variable = check_box[2], onvalue = 1, offvalue = 0)
-c_box_2.grid(row=0, column=5)
+c_button_2 = Checkbutton(condition_frame, variable=check_box[2])
+c_button_2.grid(row=0, column=5)
Label(condition_frame, text="3: ").grid(row=1, column=0)
-c_box_3 = Checkbutton(condition_frame, variable = check_box[3], onvalue = 1, offvalue = 0)
-c_box_3.grid(row=1, column=1)
+c_button_3 = Checkbutton(condition_frame, variable=check_box[3])
+c_button_3.grid(row=1, column=1)
Label(condition_frame, text="4: ").grid(row=1, column=2)
-c_box_4 = Checkbutton(condition_frame, variable = check_box[4], onvalue = 1, offvalue = 0)
-c_box_4.grid(row=1, column=3)
+c_button_4 = Checkbutton(condition_frame, variable=check_box[4])
+c_button_4.grid(row=1, column=3)
Label(condition_frame, text="5: ").grid(row=1, column=4)
-c_box_5 = Checkbutton(condition_frame, variable = check_box[5], onvalue = 1, offvalue = 0)
-c_box_5.grid(row=1, column=5)
+c_button_5 = Checkbutton(condition_frame, variable=check_box[5])
+c_button_5.grid(row=1, column=5)
Label(condition_frame, text="6: ").grid(row=2, column=0)
-c_box_6 = Checkbutton(condition_frame, variable = check_box[6], onvalue = 1, offvalue = 0)
-c_box_6.grid(row=2, column=1)
+c_button_6 = Checkbutton(condition_frame, variable=check_box[6])
+c_button_6.grid(row=2, column=1)
Label(condition_frame, text="7: ").grid(row=2, column=2)
-c_box_7 = Checkbutton(condition_frame, variable = check_box[7], onvalue = 1, offvalue = 0)
-c_box_7.grid(row=2, column=3)
+c_button_7 = Checkbutton(condition_frame, variable=check_box[7])
+c_button_7.grid(row=2, column=3)
Label(condition_frame, text="8: ").grid(row=2, column=4)
-c_box_8 = Checkbutton(condition_frame, variable = check_box[8], onvalue = 1, offvalue = 0)
-c_box_8.grid(row=2, column=5)
+c_button_8 = Checkbutton(condition_frame, variable=check_box[8])
+c_button_8.grid(row=2, column=5)
condition_frame.pack(side="top")


-add_state = Button(automata_frame, text="ADD", state="disabled")
+add_state = Button(automata_frame, text="ADD", command=handlers.add)
add_state.config(bg="blue")
change_state = Button(automata_frame, text="Change", state="disabled")
change_state.config(bg="violet")