473,654 Members | 3,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter: closing a popup menu by clicking elsewhere

How can I close a popup menu in Tkinter by clicking elsewhere on the
toplevel window underneath?

I tried popup.grab_set( ) but this causes the popup to close immediately.

An alternative would be

def hidepopup(event =None):
popup.unpost()
return "break"

root.bind_all(" <Button-1>", hidepopup)

but I'd then need a way to make sure that other bindings in children are not
processed or only processed after hidepopup.

Any hints welcome,
Peter
Jul 18 '05 #1
0 1423

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

Similar topics

2
2098
by: James Ash | last post by:
I'm writing a very simple and small Ptyhon/Tkinter application and I'm having trouble getting the menus to appear correctly. Rather than a name appearing on the menu bar, I see "()" instead. Clicking on these "()" does nothing (other than changing the appearance of them to indicated they've been pressed). I'm using Python 2.2.3 on Win2K, using a release downloaded from one of the Cygwin mirrors. This is most likely a simple mistake...
3
3331
by: DoubleM | last post by:
Hi, I'm running Python2.3.3c1 on Mandrake 9.1 The following code is designed to bring up a window with a button labeled "popup". Clicking on the popup buttons triggers a secondary window with a button labeled "ok". The second window is supposed to be modal - it should not be possible to reset the focus back to the first window or close the first window without first closing the second. The program works just fine in Windows XP...
1
2454
by: MJEASSOC | last post by:
I need some help with closing a popup window. I'm making an online portfolio, that has one base page with text and thumbnails. When a user clicks on a thumb, a new window opens containing a larger image and a caption (each contained on a separate htm document). I do this with a function in the header script as follows: var picpage=" "; var params=" ";
1
1436
by: redneon | last post by:
Is it possible to stop the menu from appearing when you click the icon on a Window's title bar? I'm wanting to use it as a button for a different purpose. I've tried capturing all the messages that run through wndproc but none of them relate to this menu. Please help, Darrell
2
2837
by: ishtar2020 | last post by:
Hi everybody I'd appreciate some help on creating a tear off menu with TkInter. I've been reading some documentation but still no luck. Please don't get confused: when I mean "tear off" menu I don't mean a drop-down or a pop-up menu, but those options which yield to another batch of sub-options when scrolled over, (as for example, the File->New option from internet explorer).
5
8040
by: SQACSharp | last post by:
I'm trying to automate an action in Internet Explorer.... I'm trying to click an image that open a popup menu. The html code of the iimage look like like <img blabla..OnClick="ShowMenu()"/> I can click the image but my application is "sleeping" until I manually click an item in the popup menu. My code : //--------------------------------//
1
3623
by: Carl | last post by:
"Chuckk Hubbard" <badmuthahubbard@gmail.comwrites: Try creating the "main" popup menu before the sub-menus, and when instantiating the sub-menus, pass the main menu as the "master" instead of "self.myparent": ....snip code ----------------------------------------- self.canvas.bind("<Button-3>",self.popup)
3
2922
by: Eric Brunel | last post by:
Hello all, I'm trying out Python 2.6 and I found what might be a bug in the Tkinter module. How can I report it? The possible bug is a traceback when trying to delete a menu item in a menu where no items have associated commands. For example: ------------------------------
1
2811
by: nihilium | last post by:
With a right click, a popup menu will appear, allowing to select from a list of colours. The queston is: is it necessary to create a callback function for each colour? How may I pass on information to the callback function? Here's a short example script: from Tkinter import * root = Tk() def colour():
0
8285
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
8706
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
8475
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
7304
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
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
5621
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2709
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
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.