Python Forum
[Tkinter] calling a new window from a tkinter window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] calling a new window from a tkinter window
I'm having trouble navigating nested windows calls with tkinter. The first window builds and executes well, with a window.mainloop() statement at at the end to set up the window polling.

But now, when I use a button to call a function, which in turn, opens up a new window, I end up with a parallel window that does not wait for the return values returned by the second function. In this case the second window is just a simple dropdown menu, with user selected choice, which should be returned to the main function. Everything works, except the code that calls the new window doesn't wait, and then execute subsequent code. I started exploring wait_window(), but don't understand how that might help.
I don't understand what you are asking, can you show a minimal example of runnable code.
In a script you can write some text, prompt for input, and perform some action based on the input. In a GUI you cannot use this pattern because the GUI cannot control what the user does next. If you draw a window with a menu the user might close your window and not make a menu selection. This must be allowed. In a GUI application you would draw the window with the menu, and specify a function to call when the menu selection is made.

So if your logic is:
Make menu
Draw menu
Wait for selection
Process selection

You should change it to:
Make menu, bind menu to call Process selection
Draw Menu

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] On Win 10, no graphical window when run code ma2020uk 0 49 Today, 12:55 AM
Last Post: ma2020uk
  tkinter: Image to Label Maryan 10 189 Yesterday, 01:48 PM
Last Post: joe_momma
  Entry Validation in tkinter shahulvk 4 113 Oct-28-2020, 10:12 PM
Last Post: joe_momma
Star [Tkinter] How to perform math function in different page of Tkinter GUI ravaru 2 116 Oct-23-2020, 05:46 PM
Last Post: deanhystad
  Tkinter - How can I remove the background borders from ttk.Button? TurboC 4 135 Oct-18-2020, 10:58 AM
Last Post: TurboC
  Tkinter - How can I extend a label widget? TurboC 2 160 Oct-13-2020, 12:15 PM
Last Post: zazas321
  [Tkinter] ClockIn/Out tkinter problem Maryan 2 169 Oct-12-2020, 03:42 AM
Last Post: joe_momma
  Tkinter menu font size -method to change tonycat 2 163 Oct-11-2020, 02:43 AM
Last Post: tonycat
  [PyQt] Received RunTimeError after script concludes, closing Dialog Window (clicking x-out) skipper0802 0 141 Oct-09-2020, 09:23 PM
Last Post: skipper0802
  tkinter | Button color text on Click Maryan 2 153 Oct-09-2020, 08:56 PM
Last Post: Maryan

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020