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)" |
---|
13 | msg = wx.StaticText(self, -1, text1, (30,15), style=wx.ALIGN_CENTRE) |
---|
14 | msg.SetLabel(text1) |
---|
15 | self.myTxtCtrl = wx.TextCtrl(self, -1, '', (100, 50)) |
---|
16 | |
---|
17 | textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, |
---|
18 | border=10) |
---|
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) |
---|
22 | self.myTxtCtrl.SetValue(str(5)) |
---|
23 | |
---|
24 | okButton = wx.Button(self, wx.ID_OK, 'OK', size=(70, 25)) |
---|
25 | closeButton = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25)) |
---|
26 | |
---|
27 | hbox.Add(okButton) |
---|
28 | hbox.Add((20, 20)) |
---|
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) |
---|
33 | mainbox.Add(hbox, flag=wx.CENTER, |
---|
34 | border=10) |
---|
35 | self.SetSizer(mainbox) |
---|
36 | |
---|
37 | def getText(self): |
---|
38 | """ |
---|
39 | Get text typed |
---|
40 | """ |
---|
41 | return self.myTxtCtrl.GetValue() |
---|