cca
changeset 9:2b99826c4d29
+continue with automata_panel
author | Ilia |
---|---|
date | Sat, 04 Dec 2010 18:21:20 +0300 |
parents | cda6324b8518 |
children | de4aaf1071ec |
files | Interface.py |
diffstat | 1 files changed, 93 insertions(+), 20 deletions(-) [+] |
line diff
1.1 --- a/Interface.py Sat Dec 04 16:26:02 2010 +0300 1.2 +++ b/Interface.py Sat Dec 04 18:21:20 2010 +0300 1.3 @@ -101,7 +101,7 @@ 1.4 pass 1.5 1.6 def automata_frame(self):# show automata_frame 1.7 - frame1.pack(side="right", fill="y", expand="no", before=canvas) 1.8 + automata_frame.pack(side="right", fill="y", expand="no", before=canvas) 1.9 1.10 def to_top(self):# replace choosen state to top 1.11 index = symbols.get(state_list.get("active").split()[1]) 1.12 @@ -153,26 +153,99 @@ 1.13 symboles = dict() 1.14 1.15 #infoPanel=Frame 1.16 -frame1=Frame(root, background="grey") 1.17 -state_list=Listbox(frame1, selectmode="extended") 1.18 +automata_frame=Frame(root, background="grey") 1.19 + 1.20 +headline_frame=Frame(automata_frame, background="white") 1.21 +head = Label(headline_frame, text= "Automata Panel", font=16) 1.22 +head.pack(side="left", expand="yes") 1.23 +hide = Button(headline_frame, text="X", command=automata_frame.forget) 1.24 +hide.config(bg="grey") 1.25 +hide.pack(side="right") 1.26 +headline_frame.pack(side="top",fill="both", expand="no") 1.27 + 1.28 +Label(automata_frame, text= "State Box:").pack(side="top", fill="x") 1.29 +statelist=Listbox(automata_frame, selectmode = "extended") 1.30 +state_list=Listbox(automata_frame, selectmode="extended") 1.31 for state in states: 1.32 state_list.insert("end", state) 1.33 state_list.pack(side="top", fill="y") 1.34 -up = Button(frame1, text="Up", state="disable") 1.35 +up = Button(automata_frame, text="Up", state="DISABLED") 1.36 up.config(bg="red") 1.37 -down = Button(frame1, text="Down", state="disable") 1.38 +down = Button(automata_frame, text="Down", state="DISABLED") 1.39 down.config(bg="orange") 1.40 -to_top = Button(frame1, text="To Top", state="disable") 1.41 +to_top = Button(automata_frame, text="To Top", state="DISABLED") 1.42 to_top.config(bg="yellow") 1.43 -to_bottom = Button(frame1, text="To Bottom", state="disable") 1.44 +to_bottom = Button(automata_frame, text="To Bottom", state="DISABLED") 1.45 to_bottom.config(bg="green") 1.46 -hide = Button(frame1, text="hide", command=frame1.forget) 1.47 -hide.config(bg="cyan") 1.48 +delete = Button(automata_frame, text="Delete", command=callback, state="disabled") 1.49 +delete.config(bg="cyan") 1.50 up.pack(side="top", fill="x") 1.51 down.pack(side="top", fill="x") 1.52 to_top.pack(side="top", fill="x") 1.53 to_bottom.pack(side="top", fill="x") 1.54 -hide.pack(side="bottom", fill="x") 1.55 +delete.pack(side="top", fill="x") 1.56 + 1.57 + 1.58 +information = Label(automata_frame, text= "Information of State") 1.59 +information.pack(side="top", fill="x") 1.60 +info_frame=Frame(automata_frame, background="white") 1.61 +Label(info_frame, text="Name").grid(row=0, column=0) 1.62 +state_name = Entry(info_frame) 1.63 +state_name.grid(row=0, column=1) 1.64 +Label(info_frame, text="Symbol").grid(row=1, column=0) 1.65 +state_symbol = Entry(info_frame) 1.66 +state_symbol.grid(row=1, column=1) 1.67 +Label(info_frame, text="Color").grid(row=2, column=0) 1.68 +state_color = Entry(info_frame) 1.69 +state_color.grid(row=2, column=1) 1.70 +Label(info_frame, text="Key").grid(row=3, column=0) 1.71 +state_key = Entry(info_frame) 1.72 +state_key.grid(row=3, column=1) 1.73 +info_frame.pack(side="top") 1.74 + 1.75 + 1.76 +condition = Label(automata_frame, text= "Condition of conversion") 1.77 +condition.pack(side="top", fill="x") 1.78 +condition_frame=Frame(automata_frame, background="white") 1.79 +Label(condition_frame, text="0: ").grid(row=0, column=0) 1.80 +check_box_0 = Checkbutton(condition_frame) 1.81 +check_box_0.grid(row=0, column=1) 1.82 +Label(condition_frame, text="1: ").grid(row=0, column=2) 1.83 +check_box_1 = Checkbutton(condition_frame) 1.84 +check_box_1.grid(row=0, column=3) 1.85 +Label(condition_frame, text="2: ").grid(row=0, column=4) 1.86 +check_box_2 = Checkbutton(condition_frame) 1.87 +check_box_2.grid(row=0, column=5) 1.88 +Label(condition_frame, text="3: ").grid(row=1, column=0) 1.89 +check_box_0 = Checkbutton(condition_frame) 1.90 +check_box_0.grid(row=1, column=1) 1.91 +Label(condition_frame, text="4: ").grid(row=1, column=2) 1.92 +check_box_1 = Checkbutton(condition_frame) 1.93 +check_box_1.grid(row=1, column=3) 1.94 +Label(condition_frame, text="5: ").grid(row=1, column=4) 1.95 +check_box_2 = Checkbutton(condition_frame) 1.96 +check_box_2.grid(row=1, column=5) 1.97 +Label(condition_frame, text="6: ").grid(row=2, column=0) 1.98 +check_box_0 = Checkbutton(condition_frame) 1.99 +check_box_0.grid(row=2, column=1) 1.100 +Label(condition_frame, text="7: ").grid(row=2, column=2) 1.101 +check_box_1 = Checkbutton(condition_frame) 1.102 +check_box_1.grid(row=2, column=3) 1.103 +Label(condition_frame, text="8: ").grid(row=2, column=4) 1.104 +check_box_2 = Checkbutton(condition_frame) 1.105 +check_box_2.grid(row=2, column=5) 1.106 +condition_frame.pack(side="top") 1.107 + 1.108 + 1.109 +add_state = Button(automata_frame, text="ADD", command=callback, state="disabled") 1.110 +add_state.config(bg="blue") 1.111 +change_state = Button(automata_frame, text="Change", command=callback, state="disabled") 1.112 +change_state.config(bg="violet") 1.113 +add_state.pack(side="top", fill="x") 1.114 +change_state.pack(side="top", fill="x") 1.115 + 1.116 +error=Label(automata_frame) 1.117 +error.pack(side="top", fill="x") 1.118 1.119 1.120 menubar = Menu(root) 1.121 @@ -180,20 +253,20 @@ 1.122 1.123 menu_file = Menu(menubar) 1.124 menu_file.add_command(label="New") 1.125 -menu_file.add_command(label="Open...") 1.126 -menu_file.add_command(label="Save...") 1.127 +menu_file.add_command(label="Open...", command=handlers.open_file) 1.128 +menu_file.add_command(label="Save...", command=handlers.save_file) 1.129 menu_file.add_separator() 1.130 -menu_file.add_command(label="Exit") 1.131 +menu_file.add_command(label="Exit", command=root.destroy) 1.132 menubar.add_cascade(label="File", menu=menu_file) 1.133 1.134 menu_action = Menu(menubar) 1.135 -menu_action.add_command(label="Start") 1.136 -menu_action.add_command(label="Stop") 1.137 -menu_action.add_command(label="Next Step") 1.138 -menu_action.add_command(label="Increase speed") 1.139 -menu_action.add_command(label="Decrease speed") 1.140 -menu_action.add_command(label="Zoom In") 1.141 -menu_action.add_command(label="Zoom Out") 1.142 +menu_action.add_command(label="Start", command=handlers.start) 1.143 +menu_action.add_command(label="Stop", command=handlers.stop) 1.144 +menu_action.add_command(label="Next Step", command=handlers.next_step) 1.145 +menu_action.add_command(label="Increase speed", command=handlers.faster) 1.146 +menu_action.add_command(label="Decrease speed", command=handlers.slower) 1.147 +menu_action.add_command(label="Zoom In", command=handlers.zoom_in) 1.148 +menu_action.add_command(label="Zoom Out", command=handlers.zoom_out) 1.149 menu_action.add_command(label="Clean field") 1.150 menu_action.add_command(label="Fill randomly") 1.151 menubar.add_cascade(label="Action", menu=menu_action)