473,588 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ 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 1784

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

Similar topics

1
5964
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 filling the remainder of the window. Mind you, this is a contrived test application to help me understand Tkinter and Python, not an actual application yet. I've trivially subclassed Tkinter.Canvas into ColorCanvas, added a bunch of ColorCanvases...
0
1429
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 called whenever the user sweeps the mouse cursor over a menu item or clicks any menu item (command or not). I have assigned functions as 'command' or 'postcommand' options of my
3
3575
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 "Introduction to Tkinter" by Fredrik Lundh (http://www.pythonware.com/library/tkinter/introduction/index.htm) What I am trying to do is add cascading menus to a Tk menu widget like:
7
2712
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 menu displays well. If I then click on the second link, the first menu from the first link still displays. How do I get make the first menu disappear when I click on the second and vice versa? Please help...thanks.
1
2008
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 Safari and Firefox views (~25%) Finding a cascading menu is easy, I trip over about half a dozen of those a week. The problem is when you maximize on a big screen in
2
2229
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 sucky; the menu stretches from the top of the moniter's window to the bottom (no matter the size of the actual application). Is there any alternative format for how a long menu gets displayed? It would be nice if say, I could make the menu only...
4
1957
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
1643
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 part level of larger part assemblies This works very well except for when a person needs to search for a specific item. Edit>Find on this page(ctrl+f) will not work because unless the menu has been broken down or "cascded" if you will, the subparts...
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7862
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5729
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3847
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.