from tkinter import *
from tkinter import ttk
import sqlite3
#NONE____
class none_none:
pass
#DATA_BASE_COMMAND
class DataBase_connect:
def __init__(self):
self.connection = sqlite3.connect('datd_base.sqlite')
self.cursor = self.connection.cursor()
def select(self, sql):
return self.cursor.execute(sql)
def one(self):
return self.cursor.fetchone()
def chall(self):
return self.cursor.fetchall()
def execute(self, sql):
self.cursor.execute(sql)
self.connection.commit()
def close(self):
self.connection.close()
db = DataBase_connect()
casement_root = none_none()
class register_main:
def __init__(self):
self.reg = Tk()
self.reg.title('РЕГИСТРАИЯ|ВХОД')
self.reg.geometry('300x180')
def reg_mainloop(self):
self.reg.mainloop()
def entr(lg,pswd):
print('Выполнил')
lbl_no = Label()
lbl_no.grid(row = 4, column = 1)
db.select("SELECT login, pssd FROM user WHERE (login,pssd) = ('%s','%s');"%(lg,pswd))
result = db.one()
print(result)
if result == None:
lbl_no.configure(text = 'НЕ ВЕРНЫЙ ЛОГИН \nИЛИ ПАРОЛЬ!')
else:
lbl_no.configure(text = 'ВХОД ВЫПОЛНИН')
def functional(self):
#LABEL
self.lbl_lg = Label(self.reg, text = 'LOGIN')
self.lbl_pswd = Label(self.reg, text = 'PASSWORD')
#ENTRY
self.enter_lg = Entry(self.reg)
self.enter_pswd = Entry(self.reg)
pswd = self.enter_lg.get()
lg = self.enter_pswd.get()
#BUTTON
self.btn_entr = Button(self.reg, text = 'LOGIN IN')
self.btn_reg = Button(self.reg, text = 'LOGIN')#, #command = register)
self.btn_entr.bind('<Button-1>', register_main.entr(lg , pswd))
#LABEL
self.lbl_lg.grid(row = 0)
self.lbl_pswd.grid(row = 1)
#ENTRY
self.enter_lg.grid(row = 0, column = 1)
self.enter_pswd.grid(row = 1, column = 1)
#BUTTON
self.btn_entr.grid(row = 2, column = 1)
self.btn_reg.grid(row = 3, column = 1)
#__________________________________________
class main():
def __init__(self):
self.root = Tk()
self.root.title('TelephoneBook v.2 | GraphickEdition')
self.root.geometry('500x400')
def main_loop(self):
self.root.mainloop()
casement_reg = register_main()
casement_reg.functional()
casement_reg.reg_mainloop()
casement_root.mainloop()
db.close()
self.название_кнопки= Button(self, text='blablabla', command = lambda: название_функции(...))
self.btn_entr = Button(self, text = 'LOGIN IN', command = lambda: register(self, login, password))