473,466 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Lazy cascading menu in Tkinter with postcommand

Hi folks, here's a challenge: I have a dynamically created cascading menu in
Tkinter that can be quite large because it is created from a file. I tried
using lazy creation so only the menu item that is actually selected by the
user gets children menu items created under it, but that fails.

I did this by use of postcommand callback, in which I dynamically add the
children menu items to the parent. However, a print statement in the
postcommand callback shows that:
1) *ALL* cascading menu items in a hierarchy get the postcommand event,
every time the user selects the top menu item
2) all children that have just been added to a cascading menu item in the
postcommand callback will hear that postcommand event

So in the end, the first time the user clicks on the top menu item, the
whole menu hierarchy gets created (though only the top level is displayed of
course).

Anyone know how to get around this? I'm considering bypassing the built-in
cascading menu and creating my own via popup menus and filtering for "on
entry" of the buttons, but there should be a simpler method.

Thanks in advance for any help,
Oliver
Jul 18 '05 #1
0 1770

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Josh | last post by:
Caution, newbie approaching... I'm trying to come up with a very simple Tkinter test application that consists of a window with a drop-down menu bar at the top and a grid of colored rectangles...
0
by: Yves Daoust | last post by:
Hi, I am rather new to Python but a skilled programmer anyway. I am working on a prototype application that has a main menu with cascaded sub-menus and commands. I'd like that even handlers be...
3
by: michelle | last post by:
Hi all, I am new to Tk, or Python GUI programming and I seem to be stuck. I have looked about for help with Tk GUIs, but everything seems so terse or incomplete?? I have been mostly using the...
7
by: Marci | last post by:
I found this script for cascading menus, however, I cannot reach the author to solve the bug I am having when I add a second menu to it. My problem is this: If I click on the first link, the...
1
by: JMosey | last post by:
Not sure if this has been covered ( a google search came up pretty bare). I have a site that: - has multi-level cascading menus - floats center of the browser window - Will have fairly heavy...
2
by: Dustan | last post by:
I don't know if this is because of Tkinter (ie Tk) itself or the Windows default way of handling things, but when I create a very long menu (my test is shown below), the way it displays is rather...
4
by: Edward K. Ream | last post by:
Hello all, Creating a 'Help' menu 'by hand' on the Mac does not work, or rather, it creates a *second* Help menu. There are hints about how to do this at:
1
by: dkirkdrei | last post by:
I am using the javascript below in conjuction with PHP to dynamically build a cascading menu of part assemblies from a database. The cascading menu allows the user to "drill" down to the single...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.