1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # myDialog.py |
---|
4 | |
---|
5 | import wx |
---|
6 | |
---|
7 | class Properties(wx.Dialog): |
---|
8 | def __init__(self, parent, id, title): |
---|
9 | wx.Dialog.__init__(self, parent, id, title, size=(300, 200)) |
---|
10 | """ |
---|
11 | for the properties window |
---|
12 | """ |
---|
13 | self.parent = parent |
---|
14 | panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) |
---|
15 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
16 | sizer = wx.GridBagSizer(5,0) |
---|
17 | vbox.Add(panel, 1, wx.EXPAND | wx.ALL) |
---|
18 | |
---|
19 | ix = 1 |
---|
20 | iy = 1 |
---|
21 | sizer.Add(wx.StaticText(panel, -1, 'X'),(iy, ix)) |
---|
22 | ix += 2 |
---|
23 | sizer.Add(wx.StaticText(panel, -1, 'Y'),(iy, ix)) |
---|
24 | ix += 2 |
---|
25 | sizer.Add(wx.StaticText(panel, -1, 'View'),(iy, ix)) |
---|
26 | iy += 1 |
---|
27 | ix = 1 |
---|
28 | self.xvalue = wx.ComboBox(panel, -1) |
---|
29 | sizer.Add(self.xvalue,(iy,ix)) |
---|
30 | ix +=2 |
---|
31 | self.yvalue = wx.ComboBox(panel, -1) |
---|
32 | sizer.Add( self.yvalue,(iy, ix)) |
---|
33 | ix +=2 |
---|
34 | view =wx.ComboBox(panel, -1, size=(60, -1)) |
---|
35 | sizer.Add(view,(iy,ix)) |
---|
36 | ix =3 |
---|
37 | iy +=3 |
---|
38 | btCancel=wx.Button(panel, wx.ID_CANCEL,'Cancel' ) |
---|
39 | sizer.Add(btCancel,(iy,ix)) |
---|
40 | ix +=2 |
---|
41 | btOk = wx.Button(panel, wx.ID_OK, "Ok") |
---|
42 | sizer.Add(btOk,(iy, ix)) |
---|
43 | |
---|
44 | # scale value for x |
---|
45 | self.xvalue.SetValue("x") |
---|
46 | self.xvalue.Insert("x",0) |
---|
47 | self.xvalue.Insert("Log(x)",1) |
---|
48 | self.xvalue.Insert("x^(2)",2) |
---|
49 | |
---|
50 | # scale value for y |
---|
51 | self.yvalue.SetValue("Log(y)") |
---|
52 | self.yvalue.Insert("y",0) |
---|
53 | self.yvalue.Insert("Log(y)",1) |
---|
54 | self.yvalue.Insert("y^(2)",2) |
---|
55 | self.yvalue.Insert("1/y",3) |
---|
56 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
57 | self.yvalue.Insert("Log(y*x)",5) |
---|
58 | self.yvalue.Insert("Log(y*x^(2))",6) |
---|
59 | |
---|
60 | panel.SetSizer(sizer) |
---|
61 | self.SetSizer(vbox) |
---|
62 | self.Centre() |
---|
63 | |
---|
64 | |
---|
65 | def setValues(self,x,y): |
---|
66 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y) |
---|
67 | |
---|
68 | def getValues(self): |
---|
69 | return self.xvalue.GetValue(), self.yvalue.GetValue() |
---|
70 | |
---|
71 | if __name__ == "__main__": |
---|
72 | app = wx.App() |
---|
73 | dialog = Properties(None, -1, 'Properties') |
---|
74 | dialog.ShowModal() |
---|
75 | app.MainLoop() |
---|
76 | |
---|
77 | |
---|