Application has been destroyed python

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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.TclError: can’t invoke «wm» command: application has been destroyed #10287

_tkinter.TclError: can’t invoke «wm» command: application has been destroyed #10287

Comments

Install
sudo python -mpip install -U matplotlib

Successfully installed matplotlib-2.1.2

 plt.show() fig.savefig('./result.png',bbox_inches='tight') # save the figure to file plt.close(fig) # close the figure 
fig.savefig('./result.png',bbox_inches='tight') # save the figure to file File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1834, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 2188, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1667, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed 

The text was updated successfully, but these errors were encountered:

Читайте также:  Объединить две строки java

Источник

Application has been destroyed python

Super Moderators

Yoriz

toplevel_windows.after(3000, toplevel_windows.destroy())

you have called the destroy method by using () so it happens imediatly, the result of the method is what is then called by after
remove the () so after makes the call itself.

toplevel_windows.after(3000, toplevel_windows.destroy)

P.S. I don’t know why you have mainloop calls everywhere you should only have the one mainloop call, the mainloop call before the after call is probably blocking so that when the window is destroyed and you call destroy the window is already destroyed.

toplevel_windows.after(3000, toplevel_windows.destroy())

you have called the destroy method by using () so it happens imediatly, the result of the method is what is then called by after
remove the () so after makes the call itself.

toplevel_windows.after(3000, toplevel_windows.destroy)

P.S. I don’t know why you have mainloop calls everywhere you should only have the one mainloop call, the mainloop call before the after call is probably blocking so that when the window is destroyed and you call destroy the window is already destroyed.

Super Moderators

deanhystad

It is likely a source of promlems instead of a solution. Tkinter is supposed to have only one mainloop.

To deanhystad, I am using a provided solution by another member as a framework. the only thing I did was add a couple of windows so I have the number of windows to match what I am trying to do. The way the script I wanto to behave is to always have a window on top so only keyboard input can be used. I am trying to replicate a pre GUI type setup from circa 1970s. I should have prefaced that, so apologies on the lack of clarity.

To yoriz, normally I would reply to this with a direct message but that option is not available to me, is the intention to keep threads as singular as possible for solutions ability, or is it to demuddle things when folks are searching for things? The forum policies are not clearly delineated in the manner and in most help forums they typically want things self contained so experience bias is apparently creating behaviors counter to what you desire here. But this is also the first real educational forum I have had any amount of interactions on. I just have to be notified on how you want behaviors to occur so I can comply, but things were not clearly defined in the forum rules outside of the usual golden rule list of things, and the plagiarism/cheating stuff. Not sure if that is an ongoing discussion regarding posting guidelines and explicitly saying if your answer created another issue, create another thread type rule, or if that rule is buried in with the others as it did not stick out for me. Having written many, many, knowledge base articles myself, sometimes you miss things trying to cover all bases and it takes occurrences to hash out where tweaks need to occur. To say it another way it is hard to follow the rules when not all the rules are written as it is assumed they are implicitly understood or you are in a kangaroo court where the rules are what whatever anyone decides at any point in time which I sincerely doubt are the case here.

As far as the code I can get the window to destroy via a button as exampled here:

from tkinter import Tk, Toplevel, Button, Label, Text import tkinter as tk import tkinter.ttk as ttk import datetime as dt import time import os from tkinter import messagebox from collections import deque from itertools import islice from threading import Thread from playsound import playsound def open_a_toplevel_window () : toplevel_window = Toplevel (root) toplevel_window.title ('Focusing on Text Entery') toplevel_window.geometry ('270x100') label = Label(toplevel_window, text = 'Enter Text Now') label.pack() text_entry = Text (toplevel_window, width = 10, height = 3) text_entry.focus_set () text_entry.pack () toplevel_window.attributes ('-topmost', True) # toplevel_window.mainloop() def open_b_toplevel_window () : toplevel_window = Toplevel (root) toplevel_window.title ('Focusing on Text Entery') toplevel_window.geometry ('270x100') label = Label(toplevel_window, text = 'Enter Text Now') label.pack() text_entry = Text (toplevel_window, width = 10, height = 3) text_entry.focus_set () text_entry.pack () toplevel_window.attributes ('-topmost', True) # toplevel_window.mainloop() def open_c_toplevel_window () : toplevel_window = Toplevel (root) toplevel_window.title ('Focusing on Text Entery') toplevel_window.geometry ('270x100') label = Label(toplevel_window, text = 'Enter Text Now') label.pack() text_entry = Text (toplevel_window, width = 10, height = 3) text_entry.focus_set () text_entry.pack () toplevel_window.attributes ('-topmost', True) # toplevel_window.mainloop() def open_d_toplevel_window () : toplevel_windows = Toplevel (root) toplevel_windows.title ('Inititaling') toplevel_windows.geometry ('512x256') toplevel_windows.configure(background='black') # toplevel_windows.overrideredirect(True) text_entry = Button (toplevel_windows, width = 10, height = 3, command=toplevel_windows.destroy) text_entry.focus_set () text_entry.pack () toplevel_windows.attributes ('-topmost', True) toplevel_windows.mainloop() root = tk.Tk () root.title ("Root Window") root.geometry ("512x256") label1 = Label (root, text = "This is the Root Window") button = Button (root, text = "Open Toplevel Window") button.config (command = open_a_toplevel_window) button1 = Button (root, text = "Open Toplevel Windowb") button1.config (command = open_b_toplevel_window) button2 = Button (root, text = "Open Toplevel Windowc") button2.config (command = open_c_toplevel_window) label1.pack () button2.place (x = 50, y = 75) button1.place (x = 210, y = 100) button.place (x = 110, y = 50) open_d_toplevel_window () root.mainloop ()

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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.TclError: can’t invoke «wm» command: application has been destroyed #10287

_tkinter.TclError: can’t invoke «wm» command: application has been destroyed #10287

Comments

Install
sudo python -mpip install -U matplotlib

Successfully installed matplotlib-2.1.2

 plt.show() fig.savefig('./result.png',bbox_inches='tight') # save the figure to file plt.close(fig) # close the figure 
fig.savefig('./result.png',bbox_inches='tight') # save the figure to file File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1834, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 2188, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1667, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed 

The text was updated successfully, but these errors were encountered:

Источник

Оцените статью