Support This Project

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. demonstrates
  • 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.

BarPlotDemo Widget demonstrates
  • 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.

BodeDemo Widget


  1. this example requires a font with some unicode support such as the MicroSoft TrueType Core Fonts
  2. the Verdana font is the best MicroSoft TrueType Core Font.
  3. use as much unicode as possible (get or buy a real unicode font).
  4. fall back on rich text if a requested glyph is missing from the font (sub-scripts are missing from the MicroSoft TrueType Core fonts). demonstates
  • 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

CartesianDemo Widget demonstrates
  • how to use QwtPlot.
  • how to produce timer events.
  • how to handle timer events by reimplementing QObject.timerEvent().

DataPlotDemo Widget demonstrates
  • 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().

ErrorBarDemo Widget demonstrates
  • 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.

MaskedDataDemo Widget

Help to stop software patents

Free software and small and/or medium sized software companies are threatened by patents on algorithms and business methods.

  1. Read this excellent explanation of the devastating effects of software patents on software (users!) and software development (developers!)
  2. Read how the European Commission and the patent lobby are still trying to introduce software patents
  3. Support the Patent Busting Project of the Electronic Frontier Foundation in the USA