[82a54b8] | 1 | import wx |
---|
| 2 | |
---|
[10bfeb3] | 3 | |
---|
[82a54b8] | 4 | class SizeDialog(wx.Dialog): |
---|
| 5 | def __init__(self, parent, id, title): |
---|
| 6 | wx.Dialog.__init__(self, parent, id, title, size=(300, 175)) |
---|
| 7 | |
---|
| 8 | mainbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 9 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 10 | textbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 11 | hbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
[940aca7] | 12 | text1 = "Enter in a custom size (> 0 accepted)" |
---|
[10bfeb3] | 13 | msg = wx.StaticText(self, -1, text1, (30,15), style=wx.ALIGN_CENTRE) |
---|
[82a54b8] | 14 | msg.SetLabel(text1) |
---|
| 15 | self.myTxtCtrl = wx.TextCtrl(self, -1, '', (100, 50)) |
---|
| 16 | |
---|
[10bfeb3] | 17 | textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, |
---|
[940aca7] | 18 | border=10) |
---|
[82a54b8] | 19 | vbox.Add(msg, flag=wx.ALL, border=10, proportion=1) |
---|
| 20 | vbox.Add(textbox, flag=wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, |
---|
| 21 | border=10) |
---|
[940aca7] | 22 | self.myTxtCtrl.SetValue(str(5)) |
---|
[82a54b8] | 23 | |
---|
[10bfeb3] | 24 | okButton = wx.Button(self, wx.ID_OK, 'OK', size=(70, 25)) |
---|
| 25 | closeButton = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25)) |
---|
[82a54b8] | 26 | |
---|
| 27 | hbox.Add(okButton) |
---|
[10bfeb3] | 28 | hbox.Add((20, 20)) |
---|
[82a54b8] | 29 | hbox.Add(closeButton) |
---|
| 30 | |
---|
| 31 | mainbox.Add(vbox, flag=wx.ALL, border=10) |
---|
| 32 | mainbox.Add(wx.StaticLine(self), 0, wx.ALL|wx.EXPAND, 5) |
---|
[10bfeb3] | 33 | mainbox.Add(hbox, flag=wx.CENTER, |
---|
[82a54b8] | 34 | border=10) |
---|
| 35 | self.SetSizer(mainbox) |
---|
| 36 | |
---|
| 37 | def getText(self): |
---|
| 38 | """ |
---|
| 39 | Get text typed |
---|
| 40 | """ |
---|
| 41 | return self.myTxtCtrl.GetValue() |
---|