Repository navigation
Expand file tree
/
Copy pathregistr.py
More file actions
78 lines (60 loc) · 1.86 KB
/
Copy pathregistr.py
File metadata and controls
78 lines (60 loc) · 1.86 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import tkinter as tk
from main import MainWindow
from database import register_user
from backBtn import BackButton
class RegistrationWindow(MainWindow):
def __init__(self):
super().__init__()
self.title("Регистрация")
# Удаляем меню главного окна
self.menu_frame.destroy()
self.registration_frame = tk.Frame(self)
self.registration_frame.place(
relx=0.5,
rely=0.5,
anchor=tk.CENTER
)
self.username_label = tk.Label(
self.registration_frame,
text="Логин"
)
self.username_label.pack(pady=5)
self.username_entry = tk.Entry(
self.registration_frame,
width=30
)
self.username_entry.pack(pady=5)
self.password_label = tk.Label(
self.registration_frame,
text="Пароль"
)
self.password_label.pack(pady=5)
self.password_entry = tk.Entry(
self.registration_frame,
width=30,
show="*"
)
self.password_entry.pack(pady=5)
self.register_btn = tk.Button(
self.registration_frame,
text="Зарегистрироваться",
width=20,
command=self.registration
)
self.register_btn.pack(pady=10)
self.back_btn = BackButton(
self.registration_frame,
command=self.go_back
)
self.back_btn.pack(pady=10)
def go_back(self):
self.destroy()
main = MainWindow()
main.mainloop()
def registration(self):
username = self.username_entry.get()
password = self.password_entry.get()
register_user(username, password)
if __name__ == "__main__":
app = RegistrationWindow()
app.mainloop()