I want to make a pop up window that requires the user to interact with before using the main window, Modal Dialog. For example, the messagebox requires the user to answer the question before moving on. If the user tries to click on the original window, the messagebox flashes and plays the iconic error sound. This is what I want; I would use a messagebox but I want to add buttons, labels, widgets, etc...
How do you make a pop up window Modal Dialog?
Related
I am simply trying to disable the user from closing a tab in tk Pnotebook (not the window close button but the tab close button)
based on tkinter pNoteBook documentation, I can only change the state of the tab itself from normal to disable to hide and that's completely not what I am asking for
Thank you
https://docs.python.org/2/library/ttk.html#ttk.Notebook
https://wiki.tcl-lang.org/page/tkinter.Notebook
check the image here
I have a tkinter application that has a main window (a Tk) and an additional window (a Toplevel).
For example, now they are both behind a web browser.
I want them both shown up in front of the web browser when either one of their icon is clicked on the taskbar.
Does tkinter have this feature?
I am trying to make a window still visible after it has lost focus. An example of what I'm trying to achieve is a window like the windows on-screen keyboard, when you click on another window, it doesn't go ontop of the on-screen keyboard window. Can anyone give me a way to do this in tkinter?
I have implemented an informational popup in a python app using a Tkinter Menu widget. I have a Text widget on a canvas in the root window. I created a Menu widget that has root as its parent. When I detect a mouse hover over the text widget I post the popup menu with menuWidget.post(). When I get a leave event from the text widget my intention was to have the popup disappear by calling menuWidget.unpost(), only the popup menu does not disappear until I click elsewhere outside the text widget.
First, is this a sane method for implementing an informational popup? And can anyone tell me why the popup menu won't disappear?
This is not the right way to do an informational popup. On the Mac and on windows machines menus are native controls. Because of this the unpost command doesn't work because tk cedes control to the system event loop in order to get platform-specific behavior.
What you want is to use instead is a toplevel window with the overrideredirect flag set. This lets you display a borderless window anywhere you want. The upside to this is that you aren't limited to simple text -- you can put anything you want in that toplevel -- another text widget, a canvas, buttons, etc.
I need to open a new window from my applications main window. This new window need to be
modal, I need to be able to get a result from the modal window based on user interaction with it.
I have figured out how to make the window modal. But I can't figure out how to return a result from the modal window and pass it back to the main window when user close the modal window.
You probably want to make your window a gtk.Dialog and launch it via the run() method. This is designed to do exactly what you are looking for.
See pygtk docs for gtk.Dialog.run