xraylarch icon indicating copy to clipboard operation
xraylarch copied to clipboard

error in plot_chifit: PyNoAppError: The wx.App object must be created first!

Open duoduoss opened this issue 2 years ago • 1 comments

Dear @newville

I have been trying to use python (in Spyder) for path fitting. I just encountered a new (it worked yesterday) error that I could not see the plots of fitting results, but the fitting itself worked out with a ".out" file: " plot_chifit(dset, title='Ti66_fitting', rmax=6)

File "C:\ProgramData\xrayLarch\lib\site-packages\larch\wxlib\xafsplots.py", line 683, in plot_chifit _plot(dataset.data.k, data_chik+offset, xmin=kmin, xmax=kmax,

File "C:\ProgramData\xrayLarch\lib\site-packages\larch\wxlib\plotter.py", line 486, in _plot plotter = _getDisplay(wxparent=wxparent, win=win, size=size,

File "C:\ProgramData\xrayLarch\lib\site-packages\larch\wxlib\plotter.py", line 339, in _getDisplay display, isnew = _get_disp(symname, creator, win, display_dict, wxparent,

File "C:\ProgramData\xrayLarch\lib\site-packages\larch\wxlib\plotter.py", line 327, in _get_disp display = creator(window=win, wxparent=wxparent,

File "C:\ProgramData\xrayLarch\lib\site-packages\larch\wxlib\plotter.py", line 114, in init PlotFrame.init(self, parent=None, size=size,

File "C:\ProgramData\xrayLarch\lib\site-packages\wxmplot\plotframe.py", line 18, in init BaseFrame.init(self, parent=parent, title=title,

File "C:\ProgramData\xrayLarch\lib\site-packages\wxmplot\baseframe.py", line 58, in init wx.Frame.init(self, parent, -1, title, **kws)

PyNoAppError: The wx.App object must be created first!"

Could you please help me with this?
Thank you in advance, Best regards

duoduoss avatar Oct 18 '22 11:10 duoduoss

@duoduoss Yes, the current plotting requires wxPython to be installed. I have not tried using that from within Spyder, but I'm not too surprised that it doesn't work very well from within a Qt environment.

newville avatar Oct 19 '22 23:10 newville

@duoduoss I am closing this issue because it was already replied by @newville. You cannot use the standard plotting of Larch inside a Qt environment. Please, use larch.plot.plotly_xafsplots module instead.

maurov avatar Mar 13 '24 08:03 maurov