-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
52 lines (44 loc) · 1.99 KB
/
settings.py
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
import tkinter as tk
from tkinter import ttk
from page import Page
import json
class Settings(Page):
def __init__(self, *args, **kwargs):
Page.__init__(self, *args, **kwargs, bg='mint cream')
label = tk.Label(self, text='Налаштування',
font='Times 20', bg='mint cream')
label.pack(side='top')
with open('configs/config.json', encoding='utf-8') as json_file:
data = json.load(json_file)
container = tk.Frame(self, bg='azure3', pady=5, padx=10)
container.pack(side='top', pady=3)
container1 = tk.Frame(container, bg='azure3', pady=5, padx=10)
container1.pack(side='top', pady=3)
var1 = tk.StringVar()
tk.Label(container1, text='Ім\'я лікаря: ',
font='Times 14', bg='azure3').pack(side='left')
entr = ttk.Entry(container1, textvariable=var1,
font='Times 14')
entr.insert(0, data['doctorName'])
entr.pack(side='left', padx=5)
def tmp1():
data['doctorName'] = var1.get()
with open('configs/config.json', 'w') as f:
f.write(json.dumps(data))
ttk.Button(container1, text='Зберегти',
command=tmp1).pack(side='left')
container2 = tk.Frame(container, bg='azure3', pady=5, padx=10)
container2.pack(side='top', pady=3)
var2 = tk.StringVar()
tk.Label(container2, text='Назва апарату УЗД: ',
font='Times 14', bg='azure3').pack(side='left')
entr2 = ttk.Entry(container2, textvariable=var2,
font='Times 14')
entr2.insert(0, data['deviceName'])
entr2.pack(side='left', padx=5)
def tmp2():
data['deviceName'] = var2.get()
with open('configs/config.json', 'w') as f:
f.write(json.dumps(data))
ttk.Button(container2, text='Зберегти',
command=tmp2).pack(side='left')