X Tutup
The Wayback Machine - https://web.archive.org/web/20221231112913/https://github.com/python/cpython/issues/100617
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tkinter "wait_window()" will hang and not spawn window on MacOS 10.14.6 #100617

Open
nalvarez508 opened this issue Dec 30, 2022 · 1 comment
Open
Labels
expert-tkinter OS-mac type-bug An unexpected behavior, bug, or error

Comments

@nalvarez508
Copy link

nalvarez508 commented Dec 30, 2022

Bug report

Using Toplevel wait_window from Tkinter on MacOS will cause the process to hang and the windows are never spawned. MRE follows:

import tkinter as tk

class MainWindow(tk.Tk):
  def __init__(self):
    super().__init__()
    self.title("Hello")
    tk.Label(self, text='Hi there').pack()

    self.after_idle(self.waitforit)
    self.mainloop()
  
  def waitforit(self):
    x = WaitedForWindow(self).show()
    print(x)

class WaitedForWindow(tk.Toplevel):
  def __init__(self, parent: tk.Tk):
    tk.Toplevel.__init__(self, parent)

    tk.Button(self, text='Press me', command=self.destroy).pack()

  def show(self):
    self.deiconify()
    self.wait_window()
    return True

if __name__ == "__main__":
  MainWindow()

Spawning a window (without calling the .show() above) will work fine, but a value cannot be returned of course, and both windows will spawn. Running the same MRE in 3.9.0 works fine.

  • Potential troubleshooting steps: Test on a Big Sur (or, just higher than Mojave) machine with 3.11.1

Your environment

  • CPython versions tested on:
    • 3.9.0 (working)
    • 3.10.9 (non-functional)
    • 3.11.1 (non-functional)
    • 3.12.0a3 (non-functional)
    • ... all 64-bit
  • Operating system and architecture: MacOS Mojave 10.14.6 x64
  • Tkinter version: 8.6.12
  • 3.9.0, 3.11.1 tested in and out of bare virtualenv
  • additional tests from colleagues:
    • W11, 3.10.5 (working)
@nalvarez508 nalvarez508 added the type-bug An unexpected behavior, bug, or error label Dec 30, 2022
@nalvarez508 nalvarez508 changed the title Tkinter wait_window will hang and not spawn window on MacOS 10.14.6 Tkinter "wait_window()" will hang and not spawn window on MacOS 10.14.6 Dec 30, 2022
@nalvarez508
Copy link
Author

nalvarez508 commented Dec 30, 2022

Tested on Windows 11 with 3.10.5 and it is working there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expert-tkinter OS-mac type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants
X Tutup