|
From: Benjamin R. <ben...@ou...> - 2013-09-17 16:34:53
|
On Tue, Sep 17, 2013 at 11:55 AM, Chad Kidder <cck...@gm...> wrote: > I'm following the MPL Qt4 example given at > http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html and > it looks like I am timing out somewhere in the setup. The error I am > getting is: > > RuntimeError: super-class __init__() of type MyDynamicMplCanvas was never > called > > It's timing out on a function that goes and talks to a piece of test > equipment to get some data to plot. That function takes on the order of a > second to complete and is located in compute_initial_figure(self): for the > previously mentioned class. I will need to make these calls whenever I go > into the update routine and they may take a few seconds to update. > > First, where is the "timeout" that I am violating? Second, how do I fix > this? Thanks for your help. > > > --Chad Kidder > > Hi Chad, I think the timeout is right over here: class MyDynamicMplCanvas(MyMplCanvas): """A canvas that updates itself every second with a new plot.""" def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), self.update_figure) timer.start(1000) My suspicion would be to either bump up that timer to take more than a second, or come up with a different signal function to more intelligently handle refreshes. Cheers! Ben Root |