Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/cca/rev/282ebe06d5ac
Дата изменения: Unknown
Дата индексирования: Mon Oct 1 23:09:05 2012
Кодировка:
cca: 282ebe06d5ac

cca

changeset 37:282ebe06d5ac

Automated merge with ssh://kodomo.fbb.msu.ru/cca
author Ilia
date Sun, 05 Dec 2010 14:47:25 +0300
parents 3d91e8bc5f70 1107500c639b
children fa1a99c88a0b 031f654a7b7d
files
diffstat 1 files changed, 35 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/Interface.py	Sun Dec 05 14:01:47 2010 +0300
     1.2 +++ b/Interface.py	Sun Dec 05 14:47:25 2010 +0300
     1.3 @@ -247,14 +247,24 @@
     1.4  
     1.5  
     1.6  root = Tk()
     1.7 -root.title("Cyclyc Cell Automata")
     1.8 +root.title("Cyclic Cellular Automata")
     1.9  
    1.10  canvas = Canvas(root, background="white")
    1.11  canvas.config(width=500, height=400)
    1.12 -canvas.pack(fill="both", expand="yes")
    1.13  
    1.14  automata = Automata(50, 50) 
    1.15 -handlers = Handlers(1, 1, 0, 0)
    1.16 +handlers = Handlers()
    1.17 +
    1.18 +canvas.bind("<1>", handlers.press1)
    1.19 +canvas.bind("<B1-Motion>", handlers.motion1)
    1.20 +canvas.bind("<3>", handlers.press3)
    1.21 +canvas.bind("<B3-Motion>", handlers.motion3)
    1.22 +canvas.bind("<Key><ButtonPress-1>", handlers.press1_key)
    1.23 +canvas.bind("<Key><B1-Motion>", handlers.motion1_key)
    1.24 +canvas.bind("<Control-ButtonPress-1>", handlers.press1_ctrl)
    1.25 +canvas.bind("<Control-B1-Motion>", handlers.motion1_ctrl)
    1.26 +
    1.27 +canvas.pack(fill="both", expand="yes")
    1.28  
    1.29  states = []
    1.30  symboles = dict()
    1.31 @@ -272,7 +282,7 @@
    1.32  
    1.33  Label(automata_frame, text= "State Box:").pack(side="top", fill="x")
    1.34  state_list=Listbox(automata_frame, selectmode="extended")
    1.35 -for state in states:
    1.36 +for state in automata.states:
    1.37  	state_list.insert("end", state)
    1.38  state_list.pack(side="top", fill="y")
    1.39  up = Button(automata_frame, text="Up", state="disabled")
    1.40 @@ -310,42 +320,43 @@
    1.41  info_frame.pack(side="top")
    1.42  
    1.43  
    1.44 -check_box = [0, 0, 0, 0, 0, 0, 0, 0, 0]
    1.45 +ckeckbox_nums = [IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), 
    1.46 +							IntVar(), IntVar(), IntVar(), IntVar()]
    1.47  
    1.48  condition = Label(automata_frame, text= "Condition of conversion")
    1.49  condition.pack(side="top", fill="x")
    1.50  condition_frame=Frame(automata_frame, background="white")
    1.51  Label(condition_frame, text="0: ").grid(row=0, column=0)
    1.52 -c_box_0 = Checkbutton(condition_frame, variable = check_box[0], onvalue = 1, offvalue = 0)
    1.53 -c_box_0.grid(row=0, column=1)
    1.54 +c_button_0 = Checkbutton(condition_frame, variable=check_box[0])
    1.55 +c_button_0.grid(row=0, column=1)
    1.56  Label(condition_frame, text="1: ").grid(row=0, column=2)
    1.57 -c_box_1 = Checkbutton(condition_frame, variable = check_box[1], onvalue = 1, offvalue = 0)
    1.58 -c_box_1.grid(row=0, column=3)
    1.59 +c_button_1 = Checkbutton(condition_frame, variable=check_box[1])
    1.60 +c_button_1.grid(row=0, column=3)
    1.61  Label(condition_frame, text="2: ").grid(row=0, column=4)
    1.62 -c_box_2 = Checkbutton(condition_frame, variable = check_box[2], onvalue = 1, offvalue = 0)
    1.63 -c_box_2.grid(row=0, column=5)
    1.64 +c_button_2 = Checkbutton(condition_frame, variable=check_box[2])
    1.65 +c_button_2.grid(row=0, column=5)
    1.66  Label(condition_frame, text="3: ").grid(row=1, column=0)
    1.67 -c_box_3 = Checkbutton(condition_frame, variable = check_box[3], onvalue = 1, offvalue = 0)
    1.68 -c_box_3.grid(row=1, column=1)
    1.69 +c_button_3 = Checkbutton(condition_frame, variable=check_box[3])
    1.70 +c_button_3.grid(row=1, column=1)
    1.71  Label(condition_frame, text="4: ").grid(row=1, column=2)
    1.72 -c_box_4 = Checkbutton(condition_frame, variable = check_box[4], onvalue = 1, offvalue = 0)
    1.73 -c_box_4.grid(row=1, column=3)
    1.74 +c_button_4 = Checkbutton(condition_frame, variable=check_box[4])
    1.75 +c_button_4.grid(row=1, column=3)
    1.76  Label(condition_frame, text="5: ").grid(row=1, column=4)
    1.77 -c_box_5 = Checkbutton(condition_frame, variable = check_box[5], onvalue = 1, offvalue = 0)
    1.78 -c_box_5.grid(row=1, column=5)
    1.79 +c_button_5 = Checkbutton(condition_frame, variable=check_box[5])
    1.80 +c_button_5.grid(row=1, column=5)
    1.81  Label(condition_frame, text="6: ").grid(row=2, column=0)
    1.82 -c_box_6 = Checkbutton(condition_frame, variable = check_box[6], onvalue = 1, offvalue = 0)
    1.83 -c_box_6.grid(row=2, column=1)
    1.84 +c_button_6 = Checkbutton(condition_frame, variable=check_box[6])
    1.85 +c_button_6.grid(row=2, column=1)
    1.86  Label(condition_frame, text="7: ").grid(row=2, column=2)
    1.87 -c_box_7 = Checkbutton(condition_frame, variable = check_box[7], onvalue = 1, offvalue = 0)
    1.88 -c_box_7.grid(row=2, column=3)
    1.89 +c_button_7 = Checkbutton(condition_frame, variable=check_box[7])
    1.90 +c_button_7.grid(row=2, column=3)
    1.91  Label(condition_frame, text="8: ").grid(row=2, column=4)
    1.92 -c_box_8 = Checkbutton(condition_frame, variable = check_box[8], onvalue = 1, offvalue = 0)
    1.93 -c_box_8.grid(row=2, column=5)
    1.94 +c_button_8 = Checkbutton(condition_frame, variable=check_box[8])
    1.95 +c_button_8.grid(row=2, column=5)
    1.96  condition_frame.pack(side="top")
    1.97  
    1.98  
    1.99 -add_state = Button(automata_frame, text="ADD", state="disabled")
   1.100 +add_state = Button(automata_frame, text="ADD", command=handlers.add)
   1.101  add_state.config(bg="blue")
   1.102  change_state = Button(automata_frame, text="Change", state="disabled")
   1.103  change_state.config(bg="violet")