-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
56 lines (45 loc) · 1.81 KB
/
settings.py
File metadata and controls
56 lines (45 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import Tkinter as tk
from Tkinter import *
import Tkinter
class SettingsGUI(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self,parent)
self.title = ("Heriot-Watt University Pi Spectrometer")
logo = Tkinter.PhotoImage(file = "img/logo/favicon32.png")
#call('wm', 'iconphoto', self._w, logo)
self.settings = Settings()
self.settings.description = "Settings for spectrometer."
lay_label = tk.Frame()
lay_label.pack(side = LEFT)
lay_value = tk.Frame()
lay_value.pack(side = RIGHT)
lay_bottom = tk.Frame()
lay_bottom.pack(side = BOTTOM)
lbl_first_name = tk.Label(lay_label, text = "First Name: ")
lbl_first_name.grid(row = 1)
txt_first_name = tk.Text(lay_value, width = 10, height = 1)
txt_first_name.grid(row = 1)
lbl_last_name = tk.Label(lay_label, text = "Last Name: ")
lbl_last_name.grid()
txt_last_name = tk.Text(lay_value,width = 10, height = 1, command = self.save_settings)
txt_last_name.grid()
lbl_scale = tk.Label(lay_label, text = "Enable graph scaling: ")
lbl_scale.grid()
rad_scaling = tk.Radiobutton(lay_value)
rad_scaling.grid()
save_button = tk.Button(lay_bottom, text = "Save"''', command = controller.save_settings(self.settings)''')
save_button.grid()
self.pack()
def save_settings(self):
self.settings.first_name = self.txt_first_name.text
self.settings.last_name = self.txt_last_name.text
class Settings:
pass
class TestController(tk.Tk):
def __init__(self, *args, **kargs):
tk.Tk.__init__(self, *args, **kargs)
self.settings = Settings()
if __name__ == "__main__":
c = TestController()
s = SettingsGUI(None, c)
s.mainloop()