Discussion:
Getting a list of curves
Arnoques
2011-06-12 16:04:32 UTC
Permalink
Hi all,
First, let me thank you for providing and supporting these great
modules! They saved me a huge amount of time. I'm developing a simple
application that needs to show data as it is measured, and I thought I
had to work with PyQwt and attach a zoomer, a scroller, etc, make a
toolbar and whatnot. But yesterday I found GUIQwt and it made my day.
Thanks!

However, I found something that may be a simple bug, or a
misunderstanding on my part. I have a CurveWidget with a CurveItem
added. However, when I try to get a list of curves for the plot, this
happens:

Relevant code:
(...snip...)
self.plotwidget = CurveWidget(...)
self.plot = self.plotwidget.get_plot()
self.curve_mean = CurveItem()
self.plot.add_item(self.curve_mean)
(...snip...)
curves = plot.get_items(False, CurveItem)

Output:
Traceback (most recent call last):
File ".../plot_guiplot.py", line 106, in activate
curves = plot.get_items(False, CurveItem)
File "/usr/lib/python2.6/dist-packages/guiqwt/baseplot.py", line
313, in get_items
assert issubclass(item_type, IItemType)
AssertionError

Should that last line be replaced by something along the lines of
what you have in add_item()? Something like:
assert hasattr(item_type, "__implements__")

assert IItemType in item.__implements__

Thanks in advance,
Arnoques

PS: It wasn't really easy to find your website... I know it's not
easy, but you might want to increase the visibility of this project. I
think it should be more widely known. To that end, I just added you to
http://wiki.python.org/moin/NumericAndScientific/Plotting
Pablo
2011-06-12 16:14:51 UTC
Permalink
Oops, disregard that, I found that i had to use
curves = plot.get_items(False, ICurveItemType)

Arnoques
Post by Arnoques
Hi all,
First, let me thank you for providing and supporting these great
modules! They saved me a huge amount of time. I'm developing a simple
application that needs to show data as it is measured, and I thought I
had to work with PyQwt and attach a zoomer, a scroller, etc, make a
toolbar and whatnot. But yesterday I found GUIQwt and it made my day.
Thanks!
However, I found something that may be a simple bug, or a
misunderstanding on my part. I have a CurveWidget with a CurveItem
added. However, when I try to get a list of curves for the plot, this
(...snip...)
self.plotwidget = CurveWidget(...)
self.plot = self.plotwidget.get_plot()
self.curve_mean = CurveItem()
self.plot.add_item(self.curve_mean)
(...snip...)
curves = plot.get_items(False, CurveItem)
File ".../plot_guiplot.py", line 106, in activate
curves = plot.get_items(False, CurveItem)
File "/usr/lib/python2.6/dist-packages/guiqwt/baseplot.py", line
313, in get_items
assert issubclass(item_type, IItemType)
AssertionError
Should that last line be replaced by something along the lines of
assert hasattr(item_type, "__implements__")
assert IItemType in item.__implements__
Thanks in advance,
Arnoques
PS: It wasn't really easy to find your website... I know it's not
easy, but you might want to increase the visibility of this project. I
think it should be more widely known. To that end, I just added you to
http://wiki.python.org/moin/NumericAndScientific/Plotting
Continue reading on narkive:
Loading...