-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui-examples.ht
193 lines (167 loc) · 5.36 KB
/
gui-examples.ht
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
Title: Graphical User Interface Examples
<h1>PyQwt Graphical User Interface Examples</h1>
<p>(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" <a href=
"http://www.qtrac.eu/pyqtbook.html">paper book</a> when you intend to do
serious PyQt and PyQwt programming.
The
<a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html">
PyQt v4 documentation</a>
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"
<a href="http://www.commandprompt.com/community/pyqt/">online book</a>.
</p>
<p> The examples below demonstrate some intermediate programming techniques
specific to (Py)Qwt.
The most advanced examples are based on subclassing of the
<tt class="class">QwtPlotItem</tt>, <tt class="class">QwtPlotCurve</tt>, and
<tt class="class">QwtData</tt> classes.
</p>
<h5><a href="examples/BarPlotDemo.py.html">BarPlotDemo.py</a> demonstrates</h5>
<ul>
<li>
how to enable plot cursor tracking by the <tt class="class">Spy</tt> class,
a subclass of <tt class="class">QObject</tt> that implements event
filtering.
</li>
<li>
how to program <tt class="class">QwtBarCurve</tt> to plot bars.
<tt class="class">QwtBarCurve</tt> is a subclass of
<tt class="class">QwtPlotCurve</tt>.
</li>
<li>
how to use a <tt class="class">QwtCounter</tt> instance to control the
number of bars to display.
</li>
<li>
how to use <tt class="class">QComboBox</tt> instances to control outline
and fill colors of the bars.
</li>
<li>
how to use <tt class="class">QwtPlotZoomer</tt>.
</li>
<li>
how to configure the <tt class="class">QwtPlotZoomer</tt> by attaching
different sets of mouse events to different zoomer actions.
</li>
</ul>
<p><img alt="BarPlotDemo Widget" src="examples/BarPlotDemo.png"
width=500 height=500 border=1></p>
<h5><a href="examples/BodeDemo.py.html">BodeDemo.py</a> demonstrates</h5>
<ul>
<li>
improved rendering of scientific formula's by a combination of rich text
and unicode.
</li>
<li>
how to customize printing by derivation from
<tt class="class">QwtPlotPrintFilter</tt>.
</li>
<li>
how to zoom on more than two scales.
</li>
</ul>
<p><img alt="BodeDemo Widget" src="examples/BodeDemo.png"
width=540 height=468 border=1>
</p>
<p>Note:
<ol>
<li>
this example requires a font with some unicode support such as the
<a href="http://corefonts.sourceforge.net">MicroSoft TrueType Core Fonts</a>
</li>
<li>
the Verdana font is the best MicroSoft TrueType Core Font.
</li>
<li>
use as much unicode as possible (get or buy a real unicode font).
</li>
<li>
fall back on rich text if a requested glyph is missing from the font
(sub-scripts are missing from the MicroSoft TrueType Core fonts).
</li>
</ol>
</p>
<h5><a href="examples/CartesianDemo.py.html">CartesianDemo.py</a>
demonstates</h5>
<ul>
<li>
how to subclass <tt class="class">QwtPlotItem</tt> so that it uses a
<tt class="class">QwtScaleDraw</tt> to draw itself
</li>
<li>
how to piggy-back on the <tt class="class">QwtScaleDiv</tt> of a hidden
axis
</li>
<li>
how to place the axes as in this
<a href="http://en.wikipedia.org/wiki/Image:Cartesian-coordinate-system.svg">
example</a>
</li>
</ul>
<p><img alt="CartesianDemo Widget" src="examples/CartesianDemo.png"
width=400 height=300 border=1>
</p>
<h5><a href="examples/DataDemo.py.html">DataDemo.py</a> demonstrates</h5>
<ul>
<li>
how to use <tt class="class">QwtPlot</tt>.
</li>
<li>
how to produce timer events.
</li>
<li>
how to handle timer events by reimplementing
<tt class="function">QObject.timerEvent()</tt>.
</li>
</ul>
<p><img alt="DataPlotDemo Widget" src="examples/DataDemo.png"
width=500 height=300 border=1>
</p>
<h5><a href="examples/ErrorBarDemo.py.html">ErrorBarDemo.py</a> demonstrates
</h5>
<ul>
<li>
how to implement a subclass of <tt class="class">QwtPlotCurve</tt> which
has error bars in either no, or the x-, or the y-, or both directions.
</li>
<li>
how to make autoscaling take account of the error bars by reimplementing
<tt class="function">QwtCurve.boundingRect()</tt>.
</li>
</ul>
<p><img alt="ErrorBarDemo Widget" src="examples/ErrorBarDemo.png"
width=400 height=300 border=1>
</p>
<h5><a href="examples/MaskedDataDemo.py.html">MaskedDataDemo.py</a> demonstrates
</h5>
<ul>
<li>
how to plot masked data by subclassing <tt class="class">QwtData</tt> and
<tt class="class">QwtPlotCurve</tt>.
</li>
<li>
how to plot several valid chunks of masked data by subclassing
<tt class="class">QwtPlotCurve</tt> and reimplementing
<tt class="function">QwtPlotCurve.draw()</tt>.
</li>
<li>
how to make autoscaling take account of the mask by subclassing
<tt class="class">QwtData</tt> and reimplementing
<tt class="function">QwtData.boundingRect()</tt>.
</li>
<li>
how to plot y = 1/sin(x) for -3 < y < 3 and -6 < x < 6.
</li>
</ul>
<p><img alt="MaskedDataDemo Widget" src="examples/MaskedDataDemo.png"
width=500 height=300 border=1>
</p>
<!--
Local Variables:
mode: HTML
fill-column: 79
End:
-->