When I don't enter name and password I want see the message in dark green window but I get an error!

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

In order to preserve formatting, please select any code or traceback that you post and then click the </> button.

I think the foreground and background colours of CTkLabel are set using fg_color and bg_color instead of fg and bg.

See the part where the error message says this?

Did you try to look at the documentation, in order to see what to pass instead of 'fg' and 'bg'?

If we check the CTkLabel documentation it shows a list of the supported arguments. It doesn’t have 'fg' or 'bg' in it. But it does have other arguments that seem to be what you want.

thanks both of you .
it solved the problem. it was fg_color instead of fg and bg_color instead of bg.
I read the document little but I couldn’t solve this problem:

# Define the function to create custom style
def set_label_colors(label):
    label.configure(fg_color="white", bg_color="green")

it is now opening the window but the background color is white and the text color is black .
I wanted that bg_color to be green and text color white .
how I can solve this problem? or where is the fault in the code?
thank you very much

Look at the descriptions for the options more carefully. There isn’t a bg_color documented here; if it’s working, that’s because it comes from the base Tkinter Label.

thank you very much .
I have solved the problem like this:

import tkinter as tk
import customtkinter
from customtkinter import CTk, CTkLabel, CTkEntry, CTkFrame, CTkButton, CTkCheckBox

# Set appearance mode and default color theme
customtkinter.set_appearance_mode("dark")
customtkinter.set_default_color_theme("dark-blue")

# Create the root window
root = CTk()
root.geometry("500x350")

# Define the function to open the new window
def open_new_window():
    new_window = CTk()
    new_window.geometry("300x200")
    new_window.title("New Window")

    # Create widgets in the new window
    name_label = CTkLabel(master=new_window, text="Name:")
    name_label.pack(pady=6)
    name_entry = CTkEntry(master=new_window)
    name_entry.pack(pady=6)
    salary_label = CTkLabel(master=new_window, text="Salary:")
    salary_label.pack(pady=6)
    salary_entry = CTkEntry(master=new_window)
    salary_entry.pack(pady=6)

    new_window.mainloop()
    
   
    
    # Define the function to create a label with custom style
def create_label_with_colors(master, text):
    return tk.Label(master=master, text=text, fg="white", bg="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 with a green background
        login_failed_window = tk.Tk()
        login_failed_window.geometry("300x100")
        login_failed_window.title("Login Failed")
        login_failed_window.configure(bg="green")

        # Create label for login failed message with custom foreground/background colors
        login_failed_label = create_label_with_colors(login_failed_window, "Login failed. Please enter username and password.")
        login_failed_label.pack(pady=20)

        login_failed_window.mainloop()


# Create login interface
frame = CTkFrame(master=root)
frame.pack(pady=20, padx=60, fill="both", expand=True)
label = CTkLabel(master=frame, text="Login System")
label.pack(pady=12, padx=10)
entry1 = CTkEntry(master=frame, placeholder_text="Username")
entry1.pack(pady=12, padx=10)
entry2 = CTkEntry(master=frame, placeholder_text="Password", show="*")
entry2.pack(pady=12, padx=10)

button = CTkButton(master=frame, text="Login", command=login)
button.pack(pady=12, padx=10)
checkbox = CTkCheckBox(master=frame, text="Remember Me")
checkbox.pack(pady=12, padx=10)

# Start the Tkinter event loop
root.mainloop()

with importing tkinter too
thanks again