Changeset 36:1107500c639b
- Timestamp:
- 12/05/10 14:47:19 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface.py
r34 r36 ˆà 248 248 ˆà 249 249 root = Tk()ˆà 250 ˆà root.title("Cycl yc CellAutomata")ˆàˆà 250 root.title("Cyclic Cellular Automata")ˆà 251 251 ˆà 252 252 canvas = Canvas(root, background="white")ˆà 253 253 canvas.config(width=500, height=400)ˆà ˆà 254 ˆà ˆà 255 automata = Automata(50, 50) ˆà ˆà 256 handlers = Handlers()ˆà ˆà 257 ˆà ˆà 258 canvas.bind("<1>", handlers.press1)ˆà ˆà 259 canvas.bind("<B1-Motion>", handlers.motion1)ˆà ˆà 260 canvas.bind("<3>", handlers.press3)ˆà ˆà 261 canvas.bind("<B3-Motion>", handlers.motion3)ˆà ˆà 262 canvas.bind("<Key><ButtonPress-1>", handlers.press1_key)ˆà ˆà 263 canvas.bind("<Key><B1-Motion>", handlers.motion1_key)ˆà ˆà 264 canvas.bind("<Control-ButtonPress-1>", handlers.press1_ctrl)ˆà ˆà 265 canvas.bind("<Control-B1-Motion>", handlers.motion1_ctrl)ˆà ˆà 266 ˆà 254 267 canvas.pack(fill="both", expand="yes")ˆà 255 ˆà ˆà256 ˆà automata = Automata(50, 50)ˆà257 ˆà handlers = Handlers(1, 1, 0, 0)ˆà258 268 ˆà 259 269 states = []ˆà òÀæ òÀæ ˆà 273 283 Label(automata_frame, text= "State Box:").pack(side="top", fill="x")ˆà 274 284 state_list=Listbox(automata_frame, selectmode="extended")ˆà 275 ˆà for state in states:ˆàˆà 285 for state in automata.states:ˆà 276 286 state_list.insert("end", state)ˆà 277 287 state_list.pack(side="top", fill="y")ˆà òÀæ òÀæ ˆà 311 321 ˆà 312 322 ˆà 313 ˆà check_box = [0, 0, 0, 0, 0, 0, 0, 0, 0]ˆà ˆà 323 ckeckbox_nums = [IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), ˆà ˆà 324 IntVar(), IntVar(), IntVar(), IntVar()]ˆà 314 325 ˆà 315 326 condition = Label(automata_frame, text= "Condition of conversion")ˆà òÀæ òÀæ ˆà 317 328 condition_frame=Frame(automata_frame, background="white")ˆà 318 329 Label(condition_frame, text="0: ").grid(row=0, column=0)ˆà 319 ˆà c_b ox_0 = Checkbutton(condition_frame, variable = check_box[0], onvalue = 1, offvalue = 0)ˆà320 ˆà c_b ox_0.grid(row=0, column=1)ˆàˆà 330 c_button_0 = Checkbutton(condition_frame, variable=check_box[0])ˆà ˆà 331 c_button_0.grid(row=0, column=1)ˆà 321 332 Label(condition_frame, text="1: ").grid(row=0, column=2)ˆà 322 ˆà c_b ox_1 = Checkbutton(condition_frame, variable = check_box[1], onvalue = 1, offvalue = 0)ˆà323 ˆà c_b ox_1.grid(row=0, column=3)ˆàˆà 333 c_button_1 = Checkbutton(condition_frame, variable=check_box[1])ˆà ˆà 334 c_button_1.grid(row=0, column=3)ˆà 324 335 Label(condition_frame, text="2: ").grid(row=0, column=4)ˆà 325 ˆà c_b ox_2 = Checkbutton(condition_frame, variable = check_box[2], onvalue = 1, offvalue = 0)ˆà326 ˆà c_b ox_2.grid(row=0, column=5)ˆàˆà 336 c_button_2 = Checkbutton(condition_frame, variable=check_box[2])ˆà ˆà 337 c_button_2.grid(row=0, column=5)ˆà 327 338 Label(condition_frame, text="3: ").grid(row=1, column=0)ˆà 328 ˆà c_b ox_3 = Checkbutton(condition_frame, variable = check_box[3], onvalue = 1, offvalue = 0)ˆà329 ˆà c_b ox_3.grid(row=1, column=1)ˆàˆà 339 c_button_3 = Checkbutton(condition_frame, variable=check_box[3])ˆà ˆà 340 c_button_3.grid(row=1, column=1)ˆà 330 341 Label(condition_frame, text="4: ").grid(row=1, column=2)ˆà 331 ˆà c_b ox_4 = Checkbutton(condition_frame, variable = check_box[4], onvalue = 1, offvalue = 0)ˆà332 ˆà c_b ox_4.grid(row=1, column=3)ˆàˆà 342 c_button_4 = Checkbutton(condition_frame, variable=check_box[4])ˆà ˆà 343 c_button_4.grid(row=1, column=3)ˆà 333 344 Label(condition_frame, text="5: ").grid(row=1, column=4)ˆà 334 ˆà c_b ox_5 = Checkbutton(condition_frame, variable = check_box[5], onvalue = 1, offvalue = 0)ˆà335 ˆà c_b ox_5.grid(row=1, column=5)ˆàˆà 345 c_button_5 = Checkbutton(condition_frame, variable=check_box[5])ˆà ˆà 346 c_button_5.grid(row=1, column=5)ˆà 336 347 Label(condition_frame, text="6: ").grid(row=2, column=0)ˆà 337 ˆà c_b ox_6 = Checkbutton(condition_frame, variable = check_box[6], onvalue = 1, offvalue = 0)ˆà338 ˆà c_b ox_6.grid(row=2, column=1)ˆàˆà 348 c_button_6 = Checkbutton(condition_frame, variable=check_box[6])ˆà ˆà 349 c_button_6.grid(row=2, column=1)ˆà 339 350 Label(condition_frame, text="7: ").grid(row=2, column=2)ˆà 340 ˆà c_b ox_7 = Checkbutton(condition_frame, variable = check_box[7], onvalue = 1, offvalue = 0)ˆà341 ˆà c_b ox_7.grid(row=2, column=3)ˆàˆà 351 c_button_7 = Checkbutton(condition_frame, variable=check_box[7])ˆà ˆà 352 c_button_7.grid(row=2, column=3)ˆà 342 353 Label(condition_frame, text="8: ").grid(row=2, column=4)ˆà 343 ˆà c_b ox_8 = Checkbutton(condition_frame, variable = check_box[8], onvalue = 1, offvalue = 0)ˆà344 ˆà c_b ox_8.grid(row=2, column=5)ˆàˆà 354 c_button_8 = Checkbutton(condition_frame, variable=check_box[8])ˆà ˆà 355 c_button_8.grid(row=2, column=5)ˆà 345 356 condition_frame.pack(side="top")ˆà 346 357 ˆà 347 358 ˆà 348 ˆà add_state = Button(automata_frame, text="ADD", state="disabled")ˆàˆà 359 add_state = Button(automata_frame, text="ADD", command=handlers.add)ˆà 349 360 add_state.config(bg="blue")ˆà 350 361 change_state = Button(automata_frame, text="Change", state="disabled")ˆà
Note: See TracChangeset
for help on using the changeset viewer.