| 1 | #####################################################################\ |
| 2 | # Note: This control is deprecated because wx.TextCtrl now supports | |
| 3 | # the wx.TE_RIGHT style flag, which makes this control completely | |
| 4 | # superfluous. | |
| 5 | #####################################################################/ |
| 6 | |
| 7 | import wx |
| 8 | import wx.lib.rightalign as right |
| 9 | |
| 10 | #---------------------------------------------------------------------- |
| 11 | |
| 12 | class TestPanel(wx.Panel): |
| 13 | def __init__(self, parent): |
| 14 | wx.Panel.__init__(self, parent, -1) |
| 15 | |
| 16 | fgs = wx.FlexGridSizer(cols=2, vgap=5, hgap=5) |
| 17 | |
| 18 | txt = wx.StaticText( |
| 19 | self, -1, |
| 20 | "These text controls will align their contents to\n" |
| 21 | "the right (on wxMSW) when they don't have focus.", |
| 22 | style=wx.ALIGN_RIGHT |
| 23 | ) |
| 24 | |
| 25 | fgs.Add(txt) |
| 26 | fgs.Add(right.RightTextCtrl(self, -1, "", size=(75, -1))) |
| 27 | |
| 28 | fgs.Add((10,10)) |
| 29 | fgs.Add(right.RightTextCtrl(self, -1, "123.45", size=(75, -1))) |
| 30 | |
| 31 | fgs.Add((10,10)) |
| 32 | fgs.Add(right.RightTextCtrl(self, -1, "234.56", size=(75, -1))) |
| 33 | |
| 34 | fgs.Add((10,10)) |
| 35 | fgs.Add(right.RightTextCtrl(self, -1, "345.67", size=(75, -1))) |
| 36 | |
| 37 | fgs.Add((10,10)) |
| 38 | fgs.Add(right.RightTextCtrl(self, -1, "456.78", size=(75, -1))) |
| 39 | |
| 40 | sizer = wx.BoxSizer(wx.VERTICAL) |
| 41 | sizer.Add(fgs, 0, wx.ALL, 25) |
| 42 | |
| 43 | self.SetSizer(sizer) |
| 44 | self.SetAutoLayout(True) |
| 45 | |
| 46 | |
| 47 | |
| 48 | #---------------------------------------------------------------------- |
| 49 | |
| 50 | def runTest(frame, nb, log): |
| 51 | win = TestPanel(nb) |
| 52 | return win |
| 53 | |
| 54 | #---------------------------------------------------------------------- |
| 55 | |
| 56 | overview = right.__doc__ |
| 57 | |
| 58 | |
| 59 | if __name__ == '__main__': |
| 60 | import sys,os |
| 61 | import run |
| 62 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |