Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import ttk
- import sqlite3
- from tkinter.filedialog import askopenfilename
- gui=Tk()
- Tk().withdraw()
- User=StringVar()
- Password=StringVar()
- def database():
- username=User.get()
- password=Password.get()
- conn = sqlite3.connect('INFO.db')
- with conn:
- cursor=conn.cursor()
- cursor.execute('CREATE TABLE IF NOT EXISTS Student (User TEXT, Password TEXT)')
- cursor.execute('INSERT INTO Student(User,Password) VALUES(?,?)',(username, password))
- conn.commit()
- def login():
- if entry in database: #The error is here
- filename=askopenfilename('parole.txt')
- print(filename)
- else:
- error = Label(gui, text='WRONG INFO', bg='red', fg='dark red').grid(x=190,y=190)
- # @@@@@@@@@@@@ INFO REGISTER @@@@@@@@@@@@@@@@@@
- def label():
- a = Label(gui,
- text='Username: ',
- fg='cyan',
- bg='dark blue').grid(row=0,column=0)
- b = Label(gui,
- text='Password: ',
- fg='cyan',
- bg='dark blue').grid(row=1,column=0)
- label()
- # @@@@@@@@@@@@@@@ INPUT @@@@@@@@@@@@@@@@@@@
- def entry():
- a1 = Entry(gui, bg='light grey', fg='black').grid(row=0,column=1)
- b1 = Entry(gui, bg='light grey', fg='black').grid(row=1,column=1)
- entry()
- # Make sure fist is capital and second is not
- gui. title("First title")
- # @@@@@@@@@@@@@@@ BUTTONS @@@@@@@@@@@@@@@@@@@@@@
- log = Button(gui, text='Log In', relief=RAISED, command=login).grid(row=2, column=0)
- register = Button(gui, text='Register', relief=RAISED, command=database).grid(row=2, column=1)
- gui.geometry('400x400')
- gui.configure(bg="black")
- gui.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement