Tkinter menu crash

Terry Reedy tjreedy at udel.edu
Tue Aug 5 19:27:33 EDT 2014


On 8/5/2014 6:28 PM, Nicholas Cannon wrote:
> Ok so I am on 2.7.8.
>> What x.y.z version of Python. How did you run it, exactly?
>
>> Adding filemenu as a submenu of filemenu leads to infinite loop regress.
>>
>> On 3.4.1 with tcl/tk 8.6, this does not crash, but it might on an
>>
>> earlier version of Python and tcl/tk.
>> Since menubar is left empty, it is not displayed.  Fix both problems with
>>
>> menubar.add_cascade(label='TK UI Sample', menu=filemenu)
>>
>> root.config(menu=menubar)
> Yeah this fixed the problem. So the main menu object needs to be cascade instead of the filemenu. Will this need to be done every I create a new menu?

I am not sure what you mean here. The main menu bar menubar is not a 
cascade. Added to root as the menu attribute, it displays horizonatally. 
You add filemenu to menebar as a cascade. It then displays vertically 
under its label on the main menu. It is fairly conventional that all the 
entries on the main menu are cascades, but apparently not necessary. It 
is also fairly conventional that most items on drop down menus are not 
cascades, but you could add a third menu to filemenu as a cascade.

>> and ran -- no crash, no error message, no menu. I entered text into box,
>> clicked Submit text, and OK on popup, and nothing happens.
> Im not quite sure what is happening here. Oh I just looked at the code and the part that sends the entry box text is in the wrong place or must have been unindented I have fixed this now and it works great.
>


-- 
Terry Jan Reedy




More information about the Python-list mailing list