Не получается передать значение из листа если там есть хоть одна буква, но цифры она передёт спокойно
from tkinter import *
import customtkinter as ctk
import tkinter.messagebox as tkmb
from tkinter import messagebox
import sys
import sqlite3
connect = sqlite3.connect('Settings.sql', check_same_thread=False)
cursor = connect.cursor()
cursor.execute(
'CREATE TABLE IF NOT EXISTS Settings (id TEXT, remember_login TEXT, remember_pass TEXT)')
connect.commit()
cursor.execute(f"SELECT id FROM Settings WHERE id = 1")
if cursor.fetchone() is None:
cursor.execute('INSERT INTO Settings VALUES (?, ?, ?)', [1, '', ''])
connect.commit()
login_form = ctk.CTk()
login_form.geometry("400x400")
login_form.title("test")
login_form.resizable(False, False)
def on_closing():
if messagebox.askokcancel("Выход", "Вы уверены что хотите выйти?"):
sys.exit()
login_form.protocol("WM_DELETE_WINDOW", on_closing)
def login():
username = list(
['ghostiki'])
password = list(
['QxHJuxQfMALgsAYmItQVvrCOkQSqNasCEMPhMydsYnpcKOsXOH'])
if user_entry.get().strip() in username and user_pass.get().strip() in password and check_var.get() == 'on':
cursor.execute(
f'UPDATE Settings SET remember_pass = {user_pass.get().strip()} WHERE id = 1')
connect.commit()
login_form.destroy()
elif user_entry.get().strip() in username and user_pass.get().strip() in password and check_var.get() == 'off':
cursor.execute(
f'UPDATE Settings SET remember_pass = 1 WHERE id = 1')
connect.commit()
login_form.destroy()
elif user_entry.get().strip() in username and user_pass.get().strip() not in password:
tkmb.showwarning(title='Wrong password',
message='Please check your password')
elif user_entry.get().strip() not in username and user_pass.get().strip() in password:
tkmb.showwarning(title='Wrong username',
message='Please check your username')
else:
tkmb.showerror(title="Login Failed",
message="Invalid Username and password")
frame = ctk.CTkFrame(master=login_form)
frame.pack(pady=20, padx=40, fill='both', expand=True)
label = ctk.CTkLabel(master=frame, text='Welcome to test!')
label.pack(pady=12, padx=10)
user_entry = ctk.CTkEntry(
master=frame, placeholder_text="Username")
user_entry.pack(pady=12, padx=10)
user_pass = ctk.CTkEntry(
master=frame, placeholder_text="Password", show="*")
user_pass.pack(pady=12, padx=10)
button = ctk.CTkButton(master=frame, text='Login', command=login)
button.pack(pady=12, padx=10)
check_var = ctk.StringVar(value="off")
checkbox = ctk.CTkCheckBox(
master=frame, text='Remember Me', variable=check_var, onvalue="on", offvalue="off")
checkbox.pack(pady=12, padx=10)
login_form.mainloop()