PyQwt Graphical User Interface Examples
(Py)Qt is a huge library offering many programming idioms to the user.
You should check out Mark Summerfeld's
"Rapid GUI Programming with Python and Qt" paper book when you intend to do
serious PyQt and PyQwt programming.
The
PyQt v4 documentation
may be sufficient for experienced Qt programmers with some Python knowledge.
A cheap and nowadays outdated start for newbies is Boudewijn Rempt's
"GUI Programming with Python Using the Qt Toolkit"
online book.
The examples below demonstrate some intermediate programming techniques
specific to (Py)Qwt.
The most advanced examples are based on subclassing of the
QwtPlotItem, QwtPlotCurve, and
QwtData classes.
-
how to enable plot cursor tracking by the Spy class,
a subclass of QObject that implements event
filtering.
-
how to program QwtBarCurve to plot bars.
QwtBarCurve is a subclass of
QwtPlotCurve.
-
how to use a QwtCounter instance to control the
number of bars to display.
-
how to use QComboBox instances to control outline
and fill colors of the bars.
-
how to use QwtPlotZoomer.
-
how to configure the QwtPlotZoomer by attaching
different sets of mouse events to different zoomer actions.
-
improved rendering of scientific formula's by a combination of rich text
and unicode.
-
how to customize printing by derivation from
QwtPlotPrintFilter.
-
how to zoom on more than two scales.
Note:
-
this example requires a font with some unicode support such as the
MicroSoft TrueType Core Fonts
-
the Verdana font is the best MicroSoft TrueType Core Font.
-
use as much unicode as possible (get or buy a real unicode font).
-
fall back on rich text if a requested glyph is missing from the font
(sub-scripts are missing from the MicroSoft TrueType Core fonts).
-
how to subclass QwtPlotItem so that it uses a
QwtScaleDraw to draw itself
-
how to piggy-back on the QwtScaleDiv of a hidden
axis
-
how to place the axes as in this
example
-
how to use QwtPlot.
-
how to produce timer events.
-
how to handle timer events by reimplementing
QObject.timerEvent().
-
how to implement a subclass of QwtPlotCurve which
has error bars in either no, or the x-, or the y-, or both directions.
-
how to make autoscaling take account of the error bars by reimplementing
QwtCurve.boundingRect().
-
how to plot masked data by subclassing QwtData and
QwtPlotCurve.
-
how to plot several valid chunks of masked data by subclassing
QwtPlotCurve and reimplementing
QwtPlotCurve.draw().
-
how to make autoscaling take account of the mask by subclassing
QwtData and reimplementing
QwtData.boundingRect().
-
how to plot y = 1/sin(x) for -3 < y < 3 and -6 < x < 6.
|