]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_stepColours.py
2 import wx
.lib
.colourselect
as cs
3 import wx
.lib
.imageutils
as iu
5 class TestPanel(wx
.Panel
):
6 def __init__(self
, *args
, **kw
):
7 wx
.Panel
.__init
__(self
, *args
, **kw
)
9 self
.colour
= wx
.NamedColour("purple")
11 self
.cpnl
= wx
.Panel(self
, size
=(100,100), style
=wx
.SIMPLE_BORDER
)
12 self
.slider
= wx
.Slider(self
,
17 style
=wx
.SL_HORIZONTAL | wx
.SL_LABELS
)
18 csel
= cs
.ColourSelect(self
, colour
=self
.colour
)
20 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
21 sizer
.Add(self
.cpnl
, 0, wx
.ALL
, 20)
22 sizer
.Add(self
.slider
, 0, wx
.LEFT
, 20)
23 sizer
.Add(csel
, 0, wx
.ALL
, 20)
26 self
.slider
.Bind(wx
.EVT_SCROLL
, self
.OnSliderChanged
)
27 self
.Bind(cs
.EVT_COLOURSELECT
, self
.OnColourSelect
)
32 def UpdatePanel(self
):
33 val
= self
.slider
.GetValue()
35 colour
= iu
.stepColour(self
.colour
, val
)
37 self
.cpnl
.SetBackgroundColour(colour
)
41 def OnSliderChanged(self
, evt
):
45 def OnColourSelect(self
, evt
):
46 self
.colour
= evt
.GetValue()
52 frm
= wx
.Frame(None, title
="Stepping Colours")