-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (40 loc) · 1.29 KB
/
main.py
File metadata and controls
47 lines (40 loc) · 1.29 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
# -*- coding: utf8 -*-
from tkinter import *
import pathmagic
from tkinter import messagebox
import mysql.connector
import front
def getText():
log1 = text.get(1.0, END)
log2 = text2.get(1.0, END)
try:
'''Подключаем mysql
Входные данные: -
Выходные данные: -
'''
mydb = mysql.connector.connect(
auth_plugin='mysql_native_password',
user=log1[:-1],
password=log2[:-1],
)
'''Создаём бд'''
mycursor = mydb.cursor()
all_dbfs = "all_in_one"
database = "CREATE DATABASE IF NOT EXISTS " + all_dbfs
mycursor.execute(database)
if front.front(log1, log2):
rt.quit()
except mysql.connector.errors.ProgrammingError:
messagebox.showinfo("Нотификация", "Неправильные данные")
rt = Tk()
rt.geometry("400x400")
rt.resizable(False, False)
lab = Label(text="Введите user и password от MySQL")
lab.place(x=120, y=160)
text = Text(width=10, height=1)
text.place(x=120, y=180)
text2 = Text(width=10, height=1)
text2.place(x=120, y=200)
bttnusr = Button(rt, text="Войти в систему", width=15, height=1, command=lambda: getText())
bttnusr.place(x=120, y=230)
rt.mainloop()