cca
changeset 55:bf831181327c
make of window
author | Ilia |
---|---|
date | Tue, 07 Dec 2010 14:14:03 +0300 |
parents | cd1c0983d3b6 |
children | df6c4316ca72 |
files | Interface.py |
diffstat | 1 files changed, 32 insertions(+), 26 deletions(-) [+] |
line diff
1.1 --- a/Interface.py Tue Dec 07 03:03:18 2010 +0300 1.2 +++ b/Interface.py Tue Dec 07 14:14:03 2010 +0300 1.3 @@ -193,9 +193,6 @@ 1.4 self.mouse_zoom = event.y 1.5 self.draw() 1.6 1.7 - def automata_frame(self):# show automata_frame 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 = automata.symbols.get(state_list.get("active").split()[0]) 1.12 state = automata.states[index] 1.13 @@ -295,8 +292,17 @@ 1.14 1.15 def show_size_window(self): 1.16 size_window.deiconify() 1.17 + 1.18 def hide_size_window(self): 1.19 size_window.withdraw() 1.20 + 1.21 + def show_automata_window(self): 1.22 + automata_window.deiconify() 1.23 + 1.24 + def hide_automata_window(self): 1.25 + automata_window.withdraw() 1.26 + 1.27 + 1.28 1.29 1.30 root = Tk() 1.31 @@ -322,30 +328,29 @@ 1.32 canvas.pack(fill="both", expand="yes") 1.33 1.34 #infoPanel=Frame 1.35 -automata_frame=Frame(root, background="white") 1.36 +automata_window = Toplevel(root) 1.37 +automata_window.title("Automata") 1.38 +automata_window.withdraw() 1.39 +automata_window.resizable(False, False) 1.40 +automata_window.protocol("WM_DELETE_WINDOW", handlers.hide_automata_window) 1.41 1.42 -headline_frame=Frame(automata_frame, background="white") 1.43 -head = Label(headline_frame, text= "Automata Panel", font=16) 1.44 -head.pack(side="left", expand="yes") 1.45 -hide = Button(headline_frame, text="X", command=automata_frame.forget) 1.46 -hide.config(bg="grey") 1.47 -hide.pack(side="right") 1.48 -headline_frame.pack(side="top",fill="both", expand="no") 1.49 +headline = Label(automata_window, text= "Automata Panel", font=16) 1.50 +headline.pack(side="top",fill="both", expand="no") 1.51 1.52 -Label(automata_frame, text= "State Box:").pack(side="top", fill="x") 1.53 -state_list=Listbox(automata_frame, selectmode="extended") 1.54 +Label(automata_window, text= "State Box:").pack(side="top", fill="x") 1.55 +state_list=Listbox(automata_window, selectmode="extended") 1.56 for state in automata.states: 1.57 state_list.insert("end", state) 1.58 state_list.pack(side="top", fill="y") 1.59 -up = Button(automata_frame, text="Up", command=handlers.upwards) 1.60 +up = Button(automata_window, text="Up", command=handlers.upwards) 1.61 up.config(bg="red") 1.62 -down = Button(automata_frame, text="Down", command=handlers.downwards) 1.63 +down = Button(automata_window, text="Down", command=handlers.downwards) 1.64 down.config(bg="orange") 1.65 -to_top = Button(automata_frame, text="To Top", command=handlers.to_top) 1.66 +to_top = Button(automata_window, text="To Top", command=handlers.to_top) 1.67 to_top.config(bg="yellow") 1.68 -to_bottom = Button(automata_frame, text="To Bottom", command=handlers.to_bottom) 1.69 +to_bottom = Button(automata_window, text="To Bottom", command=handlers.to_bottom) 1.70 to_bottom.config(bg="green") 1.71 -delete = Button(automata_frame, text="Delete", command=handlers.delete_state) 1.72 +delete = Button(automata_window, text="Delete", command=handlers.delete_state) 1.73 delete.config(bg="cyan") 1.74 up.pack(side="top", fill="x") 1.75 down.pack(side="top", fill="x") 1.76 @@ -354,9 +359,9 @@ 1.77 delete.pack(side="top", fill="x") 1.78 1.79 1.80 -information = Label(automata_frame, text= "Information of State") 1.81 +information = Label(automata_window, text= "Information of State") 1.82 information.pack(side="top", fill="x") 1.83 -info_frame=Frame(automata_frame, background="white") 1.84 +info_frame=Frame(automata_window) 1.85 Label(info_frame, text="Name").grid(row=0, column=0) 1.86 state_name = Entry(info_frame) 1.87 state_name.grid(row=0, column=1) 1.88 @@ -375,9 +380,9 @@ 1.89 ckeckbox_nums = [IntVar(), IntVar(), IntVar(), IntVar(), IntVar(), 1.90 IntVar(), IntVar(), IntVar(), IntVar()] 1.91 1.92 -condition = Label(automata_frame, text= "Condition of conversion") 1.93 +condition = Label(automata_window, text= "Condition of conversion") 1.94 condition.pack(side="top", fill="x") 1.95 -condition_frame=Frame(automata_frame, background="white") 1.96 +condition_frame=Frame(automata_window) 1.97 Label(condition_frame, text="0: ").grid(row=0, column=0) 1.98 c_button_0 = Checkbutton(condition_frame, variable=ckeckbox_nums[0]) 1.99 c_button_0.grid(row=0, column=1) 1.100 @@ -408,14 +413,14 @@ 1.101 condition_frame.pack(side="top") 1.102 1.103 1.104 -add_state = Button(automata_frame, text="Add", command=handlers.add) 1.105 +add_state = Button(automata_window, text="Add", command=handlers.add) 1.106 add_state.config(bg="blue") 1.107 -change_state = Button(automata_frame, text="Change", command=handlers.change) 1.108 +change_state = Button(automata_window, text="Change", command=handlers.change) 1.109 change_state.config(bg="violet") 1.110 add_state.pack(side="top", fill="x") 1.111 change_state.pack(side="top", fill="x") 1.112 1.113 -error=Label(automata_frame) 1.114 +error=Label(automata_window) 1.115 error.pack(side="top", fill="x") 1.116 1.117 1.118 @@ -424,6 +429,7 @@ 1.119 size_window = Toplevel(root) 1.120 size_window.title("") 1.121 size_window.withdraw() 1.122 +size_window.resizable(False, False) 1.123 size_window.protocol("WM_DELETE_WINDOW", handlers.hide_size_window) 1.124 Label(size_window, text= "Current size of window:").pack(side="top", fill="x") 1.125 size = Label(size_window, text= str(len(automata.field)) + " x " + str(len(automata.field[0]))) 1.126 @@ -496,7 +502,7 @@ 1.127 menu_action.add_command(label="Change size",command=handlers.show_size_window) 1.128 menubar.add_cascade(label="Action", menu=menu_action) 1.129 1.130 -menubar.add_command(label="Automata", command=handlers.automata_frame) 1.131 +menubar.add_command(label="Automata", command=handlers.show_automata_window) 1.132 1.133 menubar.add_command(label="Help", command=handlers.show_help_window) 1.134