]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxSpinButton.py
Applied patch [ 827011 ] Event-based processing of item tooltips in wxTreeCtrl
[wxWidgets.git] / wxPython / demo / wxSpinButton.py
CommitLineData
8fa876ca
RD
1# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
5# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
6#
7# o EVT_SPIN events (or something about them) freezes up the app.
8#
cf694132 9
8fa876ca 10import wx
cf694132 11
cf694132
RD
12#----------------------------------------------------------------------
13
8fa876ca 14class TestPanel(wx.Panel):
cf694132 15 def __init__(self, parent, log):
8fa876ca 16 wx.Panel.__init__(self, parent, -1)
cf694132
RD
17 self.log = log
18 self.count = 0
19
8fa876ca 20 wx.StaticText(self, -1, "This example uses the wxSpinButton control.", (45, 15))
cf694132 21
8fa876ca 22 self.text = wx.TextCtrl(self, -1, "1", (30, 50), (60, -1))
cf694132 23 h = self.text.GetSize().height
8fa876ca
RD
24
25 self.spin = wx.SpinButton(self, -1, (92, 50), (h, h), wx.SP_VERTICAL)
cf694132
RD
26 self.spin.SetRange(1, 100)
27 self.spin.SetValue(1)
28
8fa876ca 29 self.Bind(wx.EVT_SPIN, self.OnSpin, self.spin)
cf694132
RD
30
31
32 def OnSpin(self, event):
33 self.text.SetValue(str(event.GetPosition()))
34
35
36#----------------------------------------------------------------------
37
38def runTest(frame, nb, log):
39 win = TestPanel(nb, log)
40 return win
41
42#----------------------------------------------------------------------
43
44
cf694132 45overview = """\
8fa876ca
RD
46A wxSpinButton has two small up and down (or left and right) arrow buttons.
47It is often used next to a text control for increment and decrementing a value.
48Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
49implemented for all platforms (Win32 and GTK only currently).
1fded56b 50
8fa876ca
RD
51NB: the range supported by this control (and wxSpinCtrl) depends on the platform
52but is at least -0x8000 to 0x7fff. Under GTK and Win32 with sufficiently new version
53of comctrl32.dll (at least 4.71 is required, 5.80 is recommended) the full 32 bit
54range is supported.
1fded56b 55
8fa876ca 56"""
1fded56b
RD
57
58if __name__ == '__main__':
59 import sys,os
60 import run
61 run.main(['', os.path.basename(sys.argv[0])])