File: wx.lib.agw.pygauge.PyGauge.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (285 lines) | stat: -rw-r--r-- 11,530 bytes parent folder | download
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.pygauge

.. highlight:: python



.. _wx.lib.agw.pygauge.PyGauge:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.pygauge.PyGauge**
==========================================================================================================================================

This class provides a visual alternative for :class:`Gauge`. It currently
only support determinate mode (see :meth:`PyGauge.SetValue() <PyGauge.SetValue>` and
:meth:`PyGauge.SetRange() <PyGauge.SetRange>`).



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PyGauge</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.pygauge.PyGauge_inheritance.png" alt="Inheritance diagram of PyGauge" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.pygauge.PyGauge.html" title="wx.lib.agw.pygauge.PyGauge" alt="" coords="11,315,215,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> </map> 
   </p>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.pygauge.pygauge.png
   :alt: wxMSW
   :figclass: floatleft

   **wxMSW**


.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
   :alt: wxMAC
   :figclass: floatright

   **wxMAC**


.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.agw.pygauge.pygauge.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|




|super_classes| Known Superclasses
==================================

:class:`wx.Window`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.pygauge.PyGauge.__init__`                                     Default class constructor.
:meth:`~wx.lib.agw.pygauge.PyGauge.DoGetBestSize`                                Gets the size which best suits :class:`PyGauge`: for a control, it would be
:meth:`~wx.lib.agw.pygauge.PyGauge.GetBarColour`                                 Returns the :class:`PyGauge` main bar colour.
:meth:`~wx.lib.agw.pygauge.PyGauge.GetBarGradient`                               Returns a tuple containing the gradient start and end colours.
:meth:`~wx.lib.agw.pygauge.PyGauge.GetBorderColour`                              Returns the :class:`PyGauge` border colour.
:meth:`~wx.lib.agw.pygauge.PyGauge.GetBorderPadding`                             Gets the border padding.
:meth:`~wx.lib.agw.pygauge.PyGauge.GetRange`                                     Returns the maximum value of the gauge.
:meth:`~wx.lib.agw.pygauge.PyGauge.GetValue`                                     Returns the current position of the gauge.
:meth:`~wx.lib.agw.pygauge.PyGauge.OnEraseBackground`                            Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PyGauge`.
:meth:`~wx.lib.agw.pygauge.PyGauge.OnPaint`                                      Handles the ``wx.EVT_PAINT`` event for :class:`PyGauge`.
:meth:`~wx.lib.agw.pygauge.PyGauge.OnTimer`                                      Handles the ``wx.EVT_TIMER`` event for :class:`PyGauge`.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetBarColour`                                 Sets the :class:`PyGauge` main bar colour.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetBarGradient`                               Sets the bar gradient.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetBorderColour`                              Sets the :class:`PyGauge` border colour.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetBorderPadding`                             Sets the border padding.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetDrawValue`                                 Sets whether percentage or current value should be drawn on the gauge for precise indication.
:meth:`~wx.lib.agw.pygauge.PyGauge.SetRange`                                     Sets the range of the gauge. The gauge length is its
:meth:`~wx.lib.agw.pygauge.PyGauge.SetValue`                                     Sets the current position of the gauge.
:meth:`~wx.lib.agw.pygauge.PyGauge.SortForDisplay`                               Internal method which sorts things so we draw the longest bar first.
:meth:`~wx.lib.agw.pygauge.PyGauge.Update`                                       Update the gauge by adding `value` to it over `time` milliseconds. The `time` parameter
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: PyGauge(wx.Window)

   This class provides a visual alternative for :class:`Gauge`. It currently
   only support determinate mode (see :meth:`PyGauge.SetValue() <PyGauge.SetValue>` and
   :meth:`PyGauge.SetRange() <PyGauge.SetRange>`).

   .. method:: __init__(self, parent, id=wx.ID_ANY, range=100, pos=wx.DefaultPosition, size=(-1,30), style=0)

      Default class constructor.
      
      :param `parent`: parent window. Must not be ``None``;
      :param `id`: window identifier. A value of -1 indicates a default value;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `style`: the underlying :class:`wx.Window` window style.


   .. method:: DoGetBestSize(self)

      Gets the size which best suits :class:`PyGauge`: for a control, it would be
      the minimal size which doesn't truncate the control, for a panel - the
      same size as it would have after a call to `Fit()`.
      
      :note: Overridden from :class:`wx.Window`.


   .. method:: GetBarColour(self)

      Returns the :class:`PyGauge` main bar colour. 


   .. method:: GetBarGradient(self)

      Returns a tuple containing the gradient start and end colours. 


   .. method:: GetBorderColour(self)

      Returns the :class:`PyGauge` border colour. 


   .. method:: GetBorderPadding(self)

      Gets the border padding. 


   .. method:: GetRange(self)

      Returns the maximum value of the gauge. 


   .. method:: GetValue(self)

      Returns the current position of the gauge. 


   .. method:: OnEraseBackground(self, event)

      Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`PyGauge`.
      
      :param `event`: a :class:`EraseEvent` event to be processed.
      
      :note: This method is intentionally empty to reduce flicker.


   .. method:: OnPaint(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`PyGauge`.
      
      :param `event`: a :class:`PaintEvent` event to be processed.


   .. method:: OnTimer(self,event)

      Handles the ``wx.EVT_TIMER`` event for :class:`PyGauge`.
      
      :param `event`: a :class:`TimerEvent` event to be processed.


   .. method:: SetBarColour(self, colour)

      Sets the :class:`PyGauge` main bar colour.
      
      :param `colour`: an instance of :class:`wx.Colour`.


   .. method:: SetBarGradient(self, gradient)

      Sets the bar gradient.
      
      :param `gradient`: a tuple containing the gradient start and end colours.
      
      :note: This overrides the bar colour previously set with :meth:`PyGauge.SetBarColour`.


   .. method:: SetBorderColour(self, colour)

      Sets the :class:`PyGauge` border colour.
      
      :param `colour`: an instance of :class:`wx.Colour`.


   .. method:: SetBorderPadding(self, padding)

      Sets the border padding.
      
      :param `padding`: pixels between the border and the progress bar.


   .. method:: SetDrawValue(self, draw=True, drawPercent=True, font=None, colour=wx.BLACK, formatString=None)

      Sets whether percentage or current value should be drawn on the gauge for precise indication.
      
      :param bool `draw`: a boolean value, which if ``True`` tells to start drawing value or percentage.
       If set to ``False`` nothing will be drawn and other parameters will be ignored;
      :param bool `drawPercent`: a boolean value which indicates that a percent should be drawn instead
       of value passed in :meth:`SetValue`;
      :param wx.Font `font`: a font with which indication should be drawn, if ``None``, then ``wx.NORMAL_FONT``
       will be used. Usually text would be displayed centered in the control, but if the text font is too large
       to be displayed (either in width or height) the corresponding coordinate will be set to zero;
      :param wx.Colour `colour`: the colour with which indication should be drawn, if ``None`` then ``wx.BLACK`` will be used;
      :param string `formatString`: a string specifying format of the indication (should have one and only one
       number placeholder). If set to ``None``, will use ``{:.0f}`` format string for values and ``{:.0f}%``
       format string for percentages. As described in http://docs.python.org/library/string.html#format-specification-mini-language.
      
      .. note:: `formatString` will override addition of percent sign (after value) even if `drawPercent` is ``True``.
      
      .. versionadded:: 0.9.7


   .. method:: SetRange(self, range)

      Sets the range of the gauge. The gauge length is its
      value as a proportion of the range.
      
      :param `range`: The maximum value of the gauge.


   .. method:: SetValue(self, value)

      Sets the current position of the gauge.
      
      :param `value`: an integer specifying the current position of the gauge.


   .. method:: SortForDisplay(self)

      Internal method which sorts things so we draw the longest bar first. 


   .. method:: Update(self, value, time=0)

      Update the gauge by adding `value` to it over `time` milliseconds. The `time` parameter
      **must** be a multiple of 50 milliseconds.
      
      :param `value`: The value to be added to the gauge;
      :param `time`: The length of time in milliseconds that it will take to move the gauge.