I am just started to learn python .
this is my code :```
import customtkinter
Set appearance mode and default color theme
customtkinter.set_appearance_mode(“dark”)
customtkinter.set_default_color_theme(“dark-blue”)
Create the root window
root = customtkinter.CTk()
root.geometry(“500x350”)
Define the function to open the new window
def open_new_window():
new_window = customtkinter.CTk()
new_window.geometry(“300x200”)
new_window.title(“New Window”)
# Create widgets in the new window
name_label = customtkinter.CTkLabel(master=new_window, text="Name:")
name_label.pack(pady=6)
name_entry = customtkinter.CTkEntry(master=new_window)
name_entry.pack(pady=6)
salary_label = customtkinter.CTkLabel(master=new_window, text="Salary:")
salary_label.pack(pady=6)
salary_entry = customtkinter.CTkEntry(master=new_window)
salary_entry.pack(pady=6)
new_window.mainloop()
Define the function to create custom style
def set_label_colors(label):
label.configure(fg=“white”, bg=“dark green”)
Define the login function
def login():
# Here you can perform authentication logic
# For simplicity, I’m assuming login is successful when username and password are not empty
if entry1.get() and entry2.get():
open_new_window()
else:
# Create new window for login failed message
login_failed_window = customtkinter.CTk()
login_failed_window.geometry(“300x100”)
login_failed_window.title(“Login Failed”)
# Create label for login failed message and set foreground/background colors
login_failed_label = customtkinter.CTkLabel(master=login_failed_window, text="Login failed. Please enter username and password.")
set_label_colors(login_failed_label)
login_failed_label.pack(pady=20)
login_failed_window.mainloop()
Create login interface
frame = customtkinter.CTkFrame(master=root)
frame.pack(pady=20, padx=60, fill=“both”, expand=True)
label = customtkinter.CTkLabel(master=frame, text=“Login System”) # Remove ‘text_font’ argument
label.pack(pady=12, padx=10)
entry1 = customtkinter.CTkEntry(master=frame, placeholder_text=“Username”)
entry1.pack(pady=12, padx=10)
entry2 = customtkinter.CTkEntry(master=frame, placeholder_text=“Password”, show=“*”)
entry2.pack(pady=12, padx=10)
button = customtkinter.CTkButton(master=frame, text=“Login”, command=login)
button.pack(pady=12, padx=10)
checkbox = customtkinter.CTkCheckBox(master=frame, text=“Remember Me”)
checkbox.pack(pady=12, padx=10)
Start the Tkinter event loop
root.mainloop()
now when I click on Login whithout filling username and password I get this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter\__init__.py", line 1967, in __call__
File "customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
File "employee_management.py", line 48, in login
File "employee_management.py", line 32, in set_label_colors
File "customtkinter\windows\widgets\ctk_label.py", line 238, in configure
File "customtkinter\windows\widgets\core_widget_classes\ctk_base_class.py", line 133, in configure
File "customtkinter\windows\widgets\utility\utility_functions.py", line 18, in check_kwargs_empty
ValueError: ['fg', 'bg'] are not supported arguments. Look at the documentation for supported arguments
how I can solve this problem . can you tell me in very easy way because I am new for this subject.
thanks