[a9d5684] | 1 | import wx |
---|
| 2 | |
---|
| 3 | |
---|
| 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) |
---|
| 12 | text1 = "Enter in a custom size (> 0 accepted)" |
---|
[3477478] | 13 | msg = wx.StaticText(self, -1, text1, (30, 15), style=wx.ALIGN_CENTRE) |
---|
[a9d5684] | 14 | msg.SetLabel(text1) |
---|
[3477478] | 15 | self.text_ctrl = wx.TextCtrl(self, -1, '', (100, 50)) |
---|
| 16 | |
---|
| 17 | textbox.Add(self.text_ctrl, flag=wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, border=10) |
---|
[a9d5684] | 18 | vbox.Add(msg, flag=wx.ALL, border=10, proportion=1) |
---|
[3477478] | 19 | vbox.Add(textbox, flag=wx.EXPAND | wx.TOP | wx.BOTTOM | wx.ADJUST_MINSIZE, border=10) |
---|
| 20 | self.text_ctrl.SetValue(str(5)) |
---|
| 21 | |
---|
| 22 | ok_button = wx.Button(self, wx.ID_OK, 'OK', size=(70, 25)) |
---|
| 23 | close_button = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25)) |
---|
| 24 | |
---|
| 25 | hbox.Add(ok_button) |
---|
[a9d5684] | 26 | hbox.Add((20, 20)) |
---|
[3477478] | 27 | hbox.Add(close_button) |
---|
| 28 | |
---|
[a9d5684] | 29 | mainbox.Add(vbox, flag=wx.ALL, border=10) |
---|
[3477478] | 30 | mainbox.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5) |
---|
| 31 | mainbox.Add(hbox, flag=wx.CENTER, border=10) |
---|
[a9d5684] | 32 | self.SetSizer(mainbox) |
---|
[3477478] | 33 | |
---|
[a9d5684] | 34 | def getText(self): |
---|
| 35 | """ |
---|
| 36 | Get text typed |
---|
| 37 | """ |
---|
[3477478] | 38 | return self.text_ctrl.GetValue() |
---|