I am running Geny v-1.31 from Debian Stretch on my Linux platform.
FOr unknown reasons I have started getting error messages from a Python 3..5 script I wrote to plot multiple curves frlom data generated by a FORTRAN09 program.
Enter Molecule ID: A Traceback (most recent call last): File "MolT_5IMT_w_3_2_plot.py", line 83, in <module> fig.savefig(name_plt,bbox_inches='tight') File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1814, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2180, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed
------------------ (program exited with code: 1) Press return to continue
Unfortunately, I am an Organic Chemist and not really a Python programmer and wpuld really appreciate some help in solving this problem.
Thanks in advance.
On 2017-11-22 06:29 AM, Stephen P. Molnar wrote:
I am running Geny v-1.31 from Debian Stretch on my Linux platform.
FOr unknown reasons I have started getting error messages from a Python 3..5 script I wrote to plot multiple curves frlom data generated by a FORTRAN09 program.
Enter Molecule ID: A Traceback (most recent call last): File "MolT_5IMT_w_3_2_plot.py", line 83, in <module> fig.savefig(name_plt,bbox_inches='tight') File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1814, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2180, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed
(program exited with code: 1) Press return to continue
Unfortunately, I am an Organic Chemist and not really a Python programmer and wpuld really appreciate some help in solving this problem.
It's not a Geany related problem, it's something with your code, but it's hard to say what since you didn't attach/pastebin the code. I expect based on the error message that you are calling the 'wm' command after (or before) the tk main window has been created.
Regards, Matthew Brush
On 11/22/2017 10:13 AM, Matthew Brush wrote:
On 2017-11-22 06:29 AM, Stephen P. Molnar wrote:
I am running Geny v-1.31 from Debian Stretch on my Linux platform.
FOr unknown reasons I have started getting error messages from a Python 3..5 script I wrote to plot multiple curves frlom data generated by a FORTRAN09 program.
Enter Molecule ID: A Traceback (most recent call last): File "MolT_5IMT_w_3_2_plot.py", line 83, in <module> fig.savefig(name_plt,bbox_inches='tight') File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1814, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2180, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed
(program exited with code: 1) Press return to continue
Unfortunately, I am an Organic Chemist and not really a Python programmer and wpuld really appreciate some help in solving this problem.
It's not a Geany related problem, it's something with your code, but it's hard to say what since you didn't attach/pastebin the code. I expect based on the error message that you are calling the 'wm' command after (or before) the tk main window has been created.
Regards, Matthew Brush _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Here's the code:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_3.py
Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved.
""" import numpy as np from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA import matplotlib.pyplot as plt
data = [] name = input("Enter Molecule ID: ")
name_in = name+'_P' data = np.genfromtxt(name_in)
s = data[:,0] FTm = data[:,1] #atomic number FTe = data[:,2] #atomic mass FTc = data[:,3] #atom electron density
fig = plt.figure(figsize=(7.6,4))
host = host_subplot(111, axes_class=AA.Axes) plt.subplots_adjust(right=0.75)
par1 = host.twinx() par2 = host.twinx()
offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2,offset=(offset, 0))
par2.axis["right"].toggle(all=True)
host.set_xlim(0, 30)
host.set_ylim(min(FTm), max(FTm))
host.set_xlabel("Distance ($\AA$)") host.set_ylabel("Atomic Number") par1.set_ylabel("Atom Mass") par2.set_ylabel("Atom Electron Density")
p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density")
par1.set_ylim(min(FTe), max(FTe)) par2.set_ylim(min(FTc),max(FTc))
#host.legend()
host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) par2.axis["right"].label.set_color(p3.get_color())
host.title.set_text('Molecule: {0} - Molecular Transforms'.format(name)) plt.draw() plt.show()
#name_plt = name+'-fig1.png' name_plt = name
fig.savefig(name_plt,bbox_inches='tight')
Also attached with a copy of the input file. (I don't know if it will be stripped out or not)
Hi Stephen,
This is the Geany mailing list not the Numpy or Matplotlib or Python ML. Geany is just the editor/IDE, your problem is, as Matthew said, in your program, not in Geany. This is not the correct forum to ask questions about your program or the libraries it uses. You need to ask the question at the appropriate forum, at a guess Matplotlib might be the culprit.
Cheers Lex
On 23 November 2017 at 01:53, Stephen P. Molnar s.molnar@sbcglobal.net wrote:
On 11/22/2017 10:13 AM, Matthew Brush wrote:
On 2017-11-22 06:29 AM, Stephen P. Molnar wrote:
I am running Geny v-1.31 from Debian Stretch on my Linux platform.
FOr unknown reasons I have started getting error messages from a Python 3..5 script I wrote to plot multiple curves frlom data generated by a FORTRAN09 program.
Enter Molecule ID: A Traceback (most recent call last): File "MolT_5IMT_w_3_2_plot.py", line 83, in <module> fig.savefig(name_plt,bbox_inches='tight') File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1814, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2180, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed
(program exited with code: 1) Press return to continue
Unfortunately, I am an Organic Chemist and not really a Python programmer and wpuld really appreciate some help in solving this problem.
It's not a Geany related problem, it's something with your code, but it's hard to say what since you didn't attach/pastebin the code. I expect based on the error message that you are calling the 'wm' command after (or before) the tk main window has been created.
Regards, Matthew Brush _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Here's the code:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_3.py
Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved.
""" import numpy as np from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA import matplotlib.pyplot as plt
data = [] name = input("Enter Molecule ID: ")
name_in = name+'_P' data = np.genfromtxt(name_in)
s = data[:,0] FTm = data[:,1] #atomic number FTe = data[:,2] #atomic mass FTc = data[:,3] #atom electron density
fig = plt.figure(figsize=(7.6,4))
host = host_subplot(111, axes_class=AA.Axes) plt.subplots_adjust(right=0.75)
par1 = host.twinx() par2 = host.twinx()
offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2,offset=(offset, 0))
par2.axis["right"].toggle(all=True)
host.set_xlim(0, 30)
host.set_ylim(min(FTm), max(FTm))
host.set_xlabel("Distance ($\AA$)") host.set_ylabel("Atomic Number") par1.set_ylabel("Atom Mass") par2.set_ylabel("Atom Electron Density")
p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density")
par1.set_ylim(min(FTe), max(FTe)) par2.set_ylim(min(FTc),max(FTc))
#host.legend()
host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) par2.axis["right"].label.set_color(p3.get_color())
host.title.set_text('Molecule: {0} - Molecular Transforms'.format(name)) plt.draw() plt.show()
#name_plt = name+'-fig1.png' name_plt = name
fig.savefig(name_plt,bbox_inches='tight')
Also attached with a copy of the input file. (I don't know if it will be stripped out or not)
-- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 23 November 2017 at 05:52, Lex Trotman elextr@gmail.com wrote:
Hi Stephen,
This is the Geany mailing list not the Numpy or Matplotlib or Python ML. Geany is just the editor/IDE, your problem is, as Matthew said, in your program, not in Geany. This is not the correct forum to ask questions about your program or the libraries it uses. You need to ask the question at the appropriate forum, at a guess Matplotlib might be the culprit.
To make a non-programming analogy that hopefully will be clear, Geany is just a tool for putting together a program, just as spanners are a tool for putting together a car, but you don't ask the spanner manufacturer why your car does not work.
Cheers Lex
Cheers Lex
On 23 November 2017 at 01:53, Stephen P. Molnar s.molnar@sbcglobal.net wrote:
On 11/22/2017 10:13 AM, Matthew Brush wrote:
On 2017-11-22 06:29 AM, Stephen P. Molnar wrote:
I am running Geny v-1.31 from Debian Stretch on my Linux platform.
FOr unknown reasons I have started getting error messages from a Python 3..5 script I wrote to plot multiple curves frlom data generated by a FORTRAN09 program.
Enter Molecule ID: A Traceback (most recent call last): File "MolT_5IMT_w_3_2_plot.py", line 83, in <module> fig.savefig(name_plt,bbox_inches='tight') File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1814, in savefig self.canvas.print_figure(fname, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2180, in print_figure self.figure.dpi = dpi File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 436, in _set_dpi self.set_size_inches(w, h, forward=forward) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 745, in set_size_inches manager.resize(int(canvasw), int(canvash)) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 540, in resize self.canvas._tkcanvas.master.geometry("%dx%d" % (width, height)) File "/usr/lib/python3.5/tkinter/__init__.py", line 1698, in wm_geometry return self.tk.call('wm', 'geometry', self._w, newGeometry) _tkinter.TclError: can't invoke "wm" command: application has been destroyed
(program exited with code: 1) Press return to continue
Unfortunately, I am an Organic Chemist and not really a Python programmer and wpuld really appreciate some help in solving this problem.
It's not a Geany related problem, it's something with your code, but it's hard to say what since you didn't attach/pastebin the code. I expect based on the error message that you are calling the 'wm' command after (or before) the tk main window has been created.
Regards, Matthew Brush _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Here's the code:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_3.py
Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved.
""" import numpy as np from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA import matplotlib.pyplot as plt
data = [] name = input("Enter Molecule ID: ")
name_in = name+'_P' data = np.genfromtxt(name_in)
s = data[:,0] FTm = data[:,1] #atomic number FTe = data[:,2] #atomic mass FTc = data[:,3] #atom electron density
fig = plt.figure(figsize=(7.6,4))
host = host_subplot(111, axes_class=AA.Axes) plt.subplots_adjust(right=0.75)
par1 = host.twinx() par2 = host.twinx()
offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2,offset=(offset, 0))
par2.axis["right"].toggle(all=True)
host.set_xlim(0, 30)
host.set_ylim(min(FTm), max(FTm))
host.set_xlabel("Distance ($\AA$)") host.set_ylabel("Atomic Number") par1.set_ylabel("Atom Mass") par2.set_ylabel("Atom Electron Density")
p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density")
par1.set_ylim(min(FTe), max(FTe)) par2.set_ylim(min(FTc),max(FTc))
#host.legend()
host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) par2.axis["right"].label.set_color(p3.get_color())
host.title.set_text('Molecule: {0} - Molecular Transforms'.format(name)) plt.draw() plt.show()
#name_plt = name+'-fig1.png' name_plt = name
fig.savefig(name_plt,bbox_inches='tight')
Also attached with a copy of the input file. (I don't know if it will be stripped out or not)
-- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 2017-11-22 07:53 AM, Stephen P. Molnar wrote:
[...] host.title.set_text('Molecule: {0} - Molecular Transforms'.format(name)) plt.draw() plt.show()
#name_plt = name+'-fig1.png' name_plt = name
fig.savefig(name_plt,bbox_inches='tight')
This is the line causing the exception, presumably because matplotlib has already cleaned up tk after returning from the .show() call above once you click the X button on the window.
It works fine here if you move the `fig.savefig()` line before the `plt.show()` line so it saves the file before the window is destroyed.
Regards, Matthew Brush