-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.py
More file actions
37 lines (35 loc) · 1.2 KB
/
Logger.py
File metadata and controls
37 lines (35 loc) · 1.2 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
import PySimpleGUI as sg
def log():
f = open("user.dat", "r")
data = []
ret =None
while True:
line = f.readline()
if not line:
break
data.append(line.split(" "))
print(data[1])
sg.theme('DarkAmber') # Add a touch of color
# All the stuff inside your window.
layout = [ [sg.Text('Login'), sg.InputText("",key='-login-')],
[sg.Text('Haslo'), sg.InputText("",key='-password-')],
[sg.Button('Log') ]]
# Create the Window
window = sg.Window('Window Title', layout)
# Event Loop to process "events" and get the "values" of the inputs
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
break
if event == 'Log':
for k in data:
if(values['-login-'] == k[0]):
if(values['-password-']== k[1]):
ret = k[2][0]
print('You entered ', ret)
if ret:
break
else:
sg.popup("zly login lub haslo")
window.close()
return ret or "B"