@@ -139,22 +139,24 @@ def __init__(self, filename=None):
139139 stdout = subprocess .DEVNULL ,
140140 )
141141
142- root .grid_rowconfigure (1 , weight = 1 )
142+ root .grid_rowconfigure (0 , weight = 1 )
143143 root .grid_columnconfigure (0 , weight = 1 )
144144 root .grid_columnconfigure (1 , minsize = 90 , weight = 1 )
145145 root .grid_columnconfigure (2 , minsize = 90 , weight = 1 )
146146 root .grid_columnconfigure (3 , minsize = 90 , weight = 1 )
147147
148- self .mBar = Frame (root , relief = RAISED , borderwidth = 2 )
149- self .ExamplesBtn = self .makeLoadDemoMenu ()
150- self .OptionsBtn = self .makeHelpMenu ()
151- self .mBar .grid (row = 0 , columnspan = 4 , sticky = 'news' )
148+ self .mBar = Menu (root , relief = RAISED , borderwidth = 2 )
149+ self .mBar .add_cascade (menu = self .makeLoadDemoMenu (self .mBar ),
150+ label = 'Examples' , underline = 0 , font = menufont )
151+ self .mBar .add_cascade (menu = self .makeHelpMenu (self .mBar ),
152+ label = 'Help' , underline = 0 , font = menufont )
153+ root ['menu' ] = self .mBar
152154
153155 pane = PanedWindow (orient = HORIZONTAL , sashwidth = 5 ,
154156 sashrelief = SOLID , bg = '#ddd' )
155157 pane .add (self .makeTextFrame (pane ))
156158 pane .add (self .makeGraphFrame (pane ))
157- pane .grid (row = 1 , columnspan = 4 , sticky = 'news' )
159+ pane .grid (row = 0 , columnspan = 4 , sticky = 'news' )
158160
159161 self .output_lbl = Label (root , height = 1 , text = " --- " , bg = "#ddf" ,
160162 font = ("Arial" , 16 , 'normal' ), borderwidth = 2 ,
@@ -168,10 +170,10 @@ def __init__(self, filename=None):
168170 self .clear_btn = Button (root , text = " CLEAR " , font = btnfont ,
169171 fg = "white" , disabledforeground = "#fed" ,
170172 command = self .clearCanvas )
171- self .output_lbl .grid (row = 2 , column = 0 , sticky = 'news' , padx = (0 ,5 ))
172- self .start_btn .grid (row = 2 , column = 1 , sticky = 'ew' )
173- self .stop_btn .grid (row = 2 , column = 2 , sticky = 'ew' )
174- self .clear_btn .grid (row = 2 , column = 3 , sticky = 'ew' )
173+ self .output_lbl .grid (row = 1 , column = 0 , sticky = 'news' , padx = (0 ,5 ))
174+ self .start_btn .grid (row = 1 , column = 1 , sticky = 'ew' )
175+ self .stop_btn .grid (row = 1 , column = 2 , sticky = 'ew' )
176+ self .clear_btn .grid (row = 1 , column = 3 , sticky = 'ew' )
175177
176178 Percolator (self .text ).insertfilter (ColorDelegator ())
177179 self .dirty = False
@@ -224,7 +226,7 @@ def makeGraphFrame(self, root):
224226 return canvas
225227
226228 def configGUI (self , menu , start , stop , clear , txt = "" , color = "blue" ):
227- self .ExamplesBtn . config ( state = menu )
229+ self .mBar . entryconfigure ( 0 , state = menu )
228230
229231 self .start_btn .config (state = start ,
230232 bg = "#d00" if start == NORMAL else "#fca" )
@@ -234,35 +236,28 @@ def configGUI(self, menu, start, stop, clear, txt="", color="blue"):
234236 bg = "#d00" if clear == NORMAL else "#fca" )
235237 self .output_lbl .config (text = txt , fg = color )
236238
237- def makeLoadDemoMenu (self ):
238- CmdBtn = Menubutton (self .mBar , text = 'Examples' ,
239- underline = 0 , font = menufont )
240- CmdBtn .pack (side = LEFT , padx = "2m" )
241- CmdBtn .menu = Menu (CmdBtn )
239+ def makeLoadDemoMenu (self , master ):
240+ menu = Menu (master )
242241
243242 for entry in getExampleEntries ():
244243 def loadexample (x ):
245244 def emit ():
246245 self .loadfile (x )
247246 return emit
248- CmdBtn . menu .add_command (label = entry , underline = 0 ,
249- font = menufont , command = loadexample (entry ))
247+ menu .add_command (label = entry , underline = 0 ,
248+ font = menufont , command = loadexample (entry ))
250249
251- CmdBtn ['menu' ] = CmdBtn .menu
252- return CmdBtn
250+ return menu
253251
254- def makeHelpMenu (self ):
255- CmdBtn = Menubutton (self .mBar , text = 'Help' , underline = 0 , font = menufont )
256- CmdBtn .pack (side = LEFT , padx = '2m' )
257- CmdBtn .menu = Menu (CmdBtn )
252+ def makeHelpMenu (self , master ):
253+ menu = Menu (master )
258254
259255 for help_label , help_file in help_entries :
260256 def show (help_label = help_label , help_file = help_file ):
261257 view_text (self .root , help_label , help_file )
262- CmdBtn . menu .add_command (label = help_label , font = menufont , command = show )
258+ menu .add_command (label = help_label , font = menufont , command = show )
263259
264- CmdBtn ['menu' ] = CmdBtn .menu
265- return CmdBtn
260+ return menu
266261
267262 def refreshCanvas (self ):
268263 if not self .dirty : return
0 commit comments