8000 Remove reference to old Tk/Windows bug. · matplotlib/matplotlib@5a18309 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a18309

Browse files
committed
Remove reference to old Tk/Windows bug.
See patch. At least I can't repro it on Windows, and you'd expect it to be semi-regularly reported on the tracker if it still occurred. In the example, don't bother calling `root.destroy()`, as `root.quit()` already handles the destroying (both on Linux and Windows, an additional call to `root.destroy()` results in "can't invoke "destroy" command: application has been destroyed").
1 parent 896fb81 commit 5a18309

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

examples/user_interfaces/embedding_in_tk_sgskip.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,7 @@ def on_key_press(event):
3939

4040
canvas.mpl_connect("key_press_event", on_key_press)
4141

42-
43-
def _quit():
44-
root.quit() # Stops mainloop.
45-
# The following is necessary on Windows to prevent
46-
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
47-
root.destroy()
48-
49-
50-
button = tkinter.Button(master=root, text="Quit", command=_quit)
42+
button = tkinter.Button(master=root, text="Quit", command=root.quit)
5143
button.pack(side=tkinter.BOTTOM)
5244

5345
tkinter.mainloop()
54-
# If you put root.destroy() here, it will cause an error if the window is
55-
# closed with the window manager.

lib/matplotlib/backends/_backend_tk.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,6 @@ def resize(self, width, height):
465465
self.toolbar.configure(width=width)
466466

467467
def show(self):
468-
"""
469-
this function doesn't segfault but causes the
470-
PyEval_RestoreThread: NULL state bug on win32
471-
"""
472468
with _restore_foreground_window_at_end():
473469
if not self._shown:
474470
def destroy(*args):

0 commit comments

Comments
 (0)
0