1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
import wx
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
class TestPanel(wx.Panel):
|
1999-04-30 03:29:54 +00:00
|
|
|
def __init__(self, parent, log):
|
2003-12-09 01:23:28 +00:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
1999-04-30 03:29:54 +00:00
|
|
|
self.log = log
|
|
|
|
self.count = 0
|
|
|
|
|
2004-01-13 03:17:17 +00:00
|
|
|
wx.StaticText(self, -1, "This example shows the wx.Gauge control.", (45, 15))
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
self.g1 = wx.Gauge(self, -1, 50, (110, 50), (250, 25))
|
2000-10-30 21:08:42 +00:00
|
|
|
self.g1.SetBezelFace(3)
|
|
|
|
self.g1.SetShadowWidth(3)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
self.g2 = wx.Gauge(
|
|
|
|
self, -1, 50, (110, 95), (250, 25),
|
|
|
|
wx.GA_HORIZONTAL|wx.GA_SMOOTH
|
|
|
|
)
|
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
self.g2.SetBezelFace(5)
|
|
|
|
self.g2.SetShadowWidth(5)
|
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
self.Bind(wx.EVT_IDLE, self.IdleHandler)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
def IdleHandler(self, event):
|
|
|
|
self.count = self.count + 1
|
2003-12-09 01:23:28 +00:00
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
if self.count >= 50:
|
|
|
|
self.count = 0
|
2003-12-09 01:23:28 +00:00
|
|
|
|
2000-10-30 21:08:42 +00:00
|
|
|
self.g1.SetValue(self.count)
|
1999-04-30 03:29:54 +00:00
|
|
|
self.g2.SetValue(self.count)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2003-12-09 01:23:28 +00:00
|
|
|
A Gauge is a horizontal or vertical bar which shows a quantity in a graphical
|
|
|
|
fashion. It is often used to indicate progress through lengthy tasks, such as
|
|
|
|
file copying or data analysis.
|
2003-07-02 23:13:10 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
When the Gauge is initialized, it's "complete" value is usually set; at any rate,
|
|
|
|
before using the Gauge, the maximum value of the control must be set. As the task
|
|
|
|
progresses, the Gauge is updated by the program via the <code>SetValue</code> method.
|
2003-07-02 23:13:10 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
This control is for use within a GUI; there is a seperate ProgressDialog class
|
|
|
|
to present the same sort of control as a dialog to the user.
|
|
|
|
"""
|
2003-07-02 23:13:10 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-05 00:06:33 +00:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2003-07-02 23:13:10 +00:00
|
|
|
|