]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/RightTextCtrl.py
Set the DC font before drawing the label
[wxWidgets.git] / wxPython / demo / RightTextCtrl.py
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 The rightalign library needs converted for this to work correctly.
8 #
9 # 12/11/2003 - Jeff Grimmett (grimmtooth@softhome.net)
10 #
11 # o All issues resolved.
12 #
13 # 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
14 #
15 # o wxRightTextCtrl -> RightTextCtrl
16 #
17
18 ############################################################################\
19 # Note: this demo has been converted, but the control is deprecated because |
20 # wx.TextCtrl now supports the wx.TE_RIGHT style flag, which makes this |
21 # control completely superfluous. |
22 ############################################################################/
23
24 import wx
25 import wx.lib.rightalign as right
26
27 #----------------------------------------------------------------------
28
29 class TestPanel(wx.Panel):
30 def __init__(self, parent):
31 wx.Panel.__init__(self, parent, -1)
32
33 fgs = wx.FlexGridSizer(cols=2, vgap=5, hgap=5)
34
35 txt = wx.StaticText(
36 self, -1,
37 "These text controls will align their contents to\n"
38 "the right (on wxMSW) when they don't have focus.",
39 style=wx.ALIGN_RIGHT
40 )
41
42 fgs.Add(txt)
43 fgs.Add(right.RightTextCtrl(self, -1, "", size=(75, -1)))
44
45 fgs.Add((10,10))
46 fgs.Add(right.RightTextCtrl(self, -1, "123.45", size=(75, -1)))
47
48 fgs.Add((10,10))
49 fgs.Add(right.RightTextCtrl(self, -1, "234.56", size=(75, -1)))
50
51 fgs.Add((10,10))
52 fgs.Add(right.RightTextCtrl(self, -1, "345.67", size=(75, -1)))
53
54 fgs.Add((10,10))
55 fgs.Add(right.RightTextCtrl(self, -1, "456.78", size=(75, -1)))
56
57 sizer = wx.BoxSizer(wx.VERTICAL)
58 sizer.Add(fgs, 0, wx.ALL, 25)
59
60 self.SetSizer(sizer)
61 self.SetAutoLayout(True)
62
63
64
65 #----------------------------------------------------------------------
66
67 def runTest(frame, nb, log):
68 win = TestPanel(nb)
69 return win
70
71 #----------------------------------------------------------------------
72
73 overview = right.__doc__
74
75
76 if __name__ == '__main__':
77 import sys,os
78 import run
79 run.main(['', os.path.basename(sys.argv[0])])