TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.77k stars 1.03k forks source link

problem CTk atribute error #2478

Open Almidon809B opened 2 weeks ago

Almidon809B commented 2 weeks ago

problem sintaxis customtkinter

example: import customtkinter

def button_callback(): print("button pressed")

app = customtkinter.CTk() app.title("my app") app.geometry("400x150")

button = customtkinter.CTkButton(app, text="my button", command=button_callback) button.grid(row=0, column=0, padx=20, pady=20)

app.mainloop() ![Uploading image_2024-06-19_131513148.png…]()

code error: PS C:\Users\jorge\Desktop\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE> & C:/Users/jorge/AppData/Local/Microsoft/WindowsApps/python3.11.exe "c:/Users/jorge/Desktop/invoice/fix - Copy/puebas/PERCEO_1-6_AL_PRESENTE/pruebacustom.py" Traceback (most recent call last): File "c:\Users\jorge\Desktop\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\pruebacustom.py", line 1, in import customtkinter File "c:\Users\jorge\Desktop\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\customtkinter.py", line 6, in app = customtkinter.CTk() ^^^^^^^^^^^^^^^^^ AttributeError: partially initialized module 'customtkinter' has no attribute 'CTk' (most likely due to a circular import) PS C:\Users\jorge\Desktop\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE>

Almidon809B commented 1 week ago

I have a problem with the import of customtkinter on my computer that I get the CTk widgets that tell me that they are not defined import customtkinter

def button_callback(): print("button pressed")

app = customtkinter.CTk() app.title("my app") app.geometry("400x150")

button = customtkinter.CTkButton(app, text="my button", command=button_callback) button.grid(row=0, column=0, padx=20, pady=20)

app.mainloop()

terminal: PS C:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE> & C:/Users/jorge/AppData/Local/Microsoft/WindowsApps/python3.10.exe "c:/Users/jorge/OneDrive/Escritorio/invoice/fix - Copy/puebas/PERCEO_1-6_AL_PRESENTE/customtkinter.py" Traceback (most recent call last): File "c:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\customtkinter.py", line 1, in import customtkinter File "c:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\customtkinter.py", line 6, in app = customtkinter.CTk() AttributeError: partially initialized module 'customtkinter' has no attribute 'CTk' (most likely due to a circular import) PS C:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE> & C:/Users/jorge/AppData/Local/Microsoft/WindowsApps/python3.10.exe "c:/Users/jorge/OneDrive/Escritorio/invoice/fix - Copy/puebas/PERCEO_1-6_AL_PRESENTE/customtkinter.py" Traceback (most recent call last): File "c:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\customtkinter.py", line 1, in import customtkinter File "c:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE\customtkinter.py", line 6, in app = customtkinter.CTk() AttributeError: partially initialized module 'customtkinter' has no attribute 'CTk' (most likely due to a circular import) PS C:\Users\jorge\OneDrive\Escritorio\invoice\fix - Copy\puebas\PERCEO_1-6_AL_PRESENTE>

YmClash commented 2 days ago

me tooo

mate02102003 commented 1 day ago

Why is there a customtkinter.py? It should be a folder, not a file.

How did you install it?

YmClash commented 1 day ago

It's Ok now ;) I will resolve the issues. I had the wrong version and my Dev env was on Conda Thank for the response

Almidon809B commented 1 day ago

Yes, I already had it installed but I already found the problem, I brought a python file called customtkinter.py and I already deleted it and it was solved