2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
|
|
|
import wx.lib.analogclock as aclock
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel(wx.Panel):
|
2003-07-02 19:13:10 -04:00
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# A red background with blue hands and white markings
|
|
|
|
c1 = aclock.AnalogClockWindow(self)
|
2003-07-02 19:13:10 -04:00
|
|
|
c1.SetBackgroundColour("RED")
|
|
|
|
c1.SetHandsColour("BLUE")
|
|
|
|
c1.SetTickMarkColours("WHITE")
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# A white background with red hands and blue markings
|
|
|
|
c2 = aclock.AnalogClockWindow(self)
|
2003-07-02 19:13:10 -04:00
|
|
|
c2.SetBackgroundColour("WHITE")
|
|
|
|
c2.SetHandsColour("RED")
|
|
|
|
c2.SetTickMarkColours("BLUE")
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# A blue background with white hands and red markings
|
|
|
|
c3 = aclock.AnalogClockWindow(self)
|
2003-07-02 19:13:10 -04:00
|
|
|
c3.SetBackgroundColour("BLUE")
|
|
|
|
c3.SetHandsColour("WHITE")
|
|
|
|
c3.SetTickMarkColours("RED")
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# Raised border, circular tick marks.
|
|
|
|
c4 = aclock.AnalogClockWindow(self, style=wx.RAISED_BORDER)
|
|
|
|
c4.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_CIRCLE)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# No tick marks
|
|
|
|
c5 = aclock.AnalogClockWindow(self)
|
|
|
|
c5.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_NONE)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# Sunken into window
|
|
|
|
c6 = aclock.AnalogClockWindow(self, style=wx.SUNKEN_BORDER)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
# layout the clocks in a grid sizer
|
|
|
|
gs = wx.GridSizer(2, 3, 4, 4)
|
|
|
|
gs.Add(c1, 0, wx.EXPAND)
|
|
|
|
gs.Add(c2, 0, wx.EXPAND)
|
|
|
|
gs.Add(c3, 0, wx.EXPAND)
|
|
|
|
gs.Add(c4, 0, wx.EXPAND)
|
|
|
|
gs.Add(c5, 0, wx.EXPAND)
|
|
|
|
gs.Add(c6, 0, wx.EXPAND)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
# put it in another sizer for a border
|
2003-12-08 20:23:28 -05:00
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
sizer.Add(gs, 1, wx.EXPAND|wx.ALL, 10)
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
self.SetSizer(sizer)
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """<html><body>
|
|
|
|
<h2><center>AnalogClockWindow</center></h2>
|
|
|
|
|
|
|
|
This is a nice little clock class that was contributed to by several
|
|
|
|
members of the wxPython-users group.
|
|
|
|
|
|
|
|
</body></html>
|
|
|
|
"""
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|