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
TclError for draw_event handler calling close() #3484
Comments
I am not able to reproduce on the master. I'll try 1.4.0 |
What you're doing seems invalid - basically closing the figure in the process of trying to draw the figure. What exactly are you trying to do? |
I was trying to open and immediately close the figure. I never really thought about it being invalid, I guess that makes some sense. I'm sure it worked before, but if it's not supported behaviour then this issue can be closed. |
The reason why it may have worked in the past is that the callback So, I think what might be "broken" is that there is currently no way to On Sun, Sep 7, 2014 at 3:07 PM, mdilli notifications@github.com wrote:
|
Why do you want to open and then close a figure? If you do not want to display the figure use a non-interactive backend (ex 'agg'). Before you import pyplot use
|
@mdilli I am going to close this as I don't think there is really a bug here. Please send an email to the matplotlib-user email list asking about what you are trying to accomplish. Ping to re-open this issue if you think there is a bug here and we are not understanding it. |
I found what I am pretty sure is a bug. Took me a while to find the cause because it happens in an event handler and the line number of my code is not in the backtrace. I don't think it affects many people, but a bug nonetheless.
This functionality has worked for me for another install on the same PC, at some point in the past (I don't know which versions).
backend: TkAgg
matplotlib: I tried v1.3.1 (through apt-get) and v1.4.0 (through pip in virtualenv)
python: v2.7.6
ubuntu: v14.04LTS
hardware: not a hardware issue; it worked in the past
from matplotlib.pyplot import subplots, close
fig, ax = subplots()
fig.canvas.mpl_connect('draw_event', lambda event: close(fig))
fig.show()
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in call
return self.func(*args)
File "/home/username/TMP/env/local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 278, in resize
self.show()
File "/home/username/TMP/env/local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 350, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "/home/username/TMP/env/local/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 24, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError: this isn't a Tk application
Segmentation fault (core dumped)
The text was updated successfully, but these errors were encountered: