Re: Plotting in WxPython

Dietmar Schwertberger <[email protected]> Mon, 22 Aug 2022 15:17:00 +0200
Newsgroups gmane.comp.python.wxglade
Message-ID <[email protected]>
On 22.08.2022 13:48, Tanmay Agrawal wrote:
> self.canvas = FigureCanvas(self, -1, fig)
> TypeError: __init__() takes from 1 to 2 positional arguments but 4 
> were given

I would guess that you're using a wrong Canvas version.

wxGlade includes three matplotlib examples.


Code from the first example:

import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as 
FigureCanvas

figure = Figure()
self.matplotlib_axes = figure.add_subplot(111)
self.matplotlib_canvas = FigureCanvas(self.panel_1, wx.ID_ANY, figure)


Regards,

Dietmar