jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 68 forks source link

Matplotlib issues - 'FigureCanvasTkAgg' object has no attribute 'show' #551

Closed simonjharris closed 5 years ago

simonjharris commented 5 years ago

Context


I wanted to started testing matplotlib integration with appJar, unfortunately when I tried to run the example code from http://appjar.info/outputWidgets/#matplotlib, I get error messages.

Any error messages produced by appJar


Traceback (most recent call last): File "/Users/simon/PycharmProjects/data_analysis/gui_graphs.py", line 23, in axes = app.addPlot("p1", *getXY()) File "/Users/simon/PycharmProjects/TestProject/venv/lib/python3.7/site-packages/appJar/appjar.py", line 6392, in addPlot canvas, fig = self._addPlotFig(title, row, column, colspan, rowspan, width, height) File "/Users/simon/PycharmProjects/TestProject/venv/lib/python3.7/site-packages/appJar/appjar.py", line 6416, in _addPlotFig canvas.show() AttributeError: 'FigureCanvasTkAgg' object has no attribute 'show'

Version Information


Tested on mac with python 3.7.0 and ubuntu with 3.6.0. Matplotlib version 3.0.1, appJar 0.93.

pjgao commented 5 years ago

try function draw instead

Mr-Jarvis commented 5 years ago

This has been resolved in the next release - as @pjgao mentions, it should be using draw()

jarvisteach commented 5 years ago

Duplicate of #549

tnsolley commented 5 years ago

Running into this issue myself. Can you be more specific on what you mean by "use function draw instead"?

Example; "Please change line 6416 in from canvas.show() to canvas.draw()"...

tnsolley commented 5 years ago

Note; actually making that change throws a Tkinter error;

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
===== RESTART: //cotofs01/tsolley$/Coto/Vibration_tester/test_layout.py =====
2019-02-14 09:26:35,105 appJar:ERROR [Line 107->1706/__exit__]: ContextManager failed: cannot use geometry manager pack inside .!canvasdnd.!widgetcontainer.!tabbedframe.!framestack.!frame2.!labelframe which already has slaves managed by grid
Traceback (most recent call last):
  File "//cotofs01/tsolley$/Coto/Vibration_tester/test_layout.py", line 99, in <module>
    axes = app.addPlot("p1", *getXY())
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\appJar\appjar.py", line 6392, in addPlot
    canvas, fig = self._addPlotFig(title, row, column, colspan, rowspan, width, height)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\appJar\appjar.py", line 6419, in _addPlotFig
    canvas._tkcanvas.pack(side=TOP, fill=BOTH, expand=1)
  File "C:\Program Files (x86)\Python37-32\lib\tkinter\__init__.py", line 2143, in pack_configure
    + self._options(cnf, kw))
_tkinter.TclError: cannot use geometry manager pack inside .!canvasdnd.!widgetcontainer.!tabbedframe.!framestack.!frame2.!labelframe which already has slaves managed by grid
>>>