TomSchimansky / CustomTkinter

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

CTkOptionMenu : _tkinter.TclError: unknown option "-angle" #2279

Closed absingh22 closed 4 months ago

absingh22 commented 4 months ago

I keep getting the ' _tkinter.TclError: unknown option "-angle" ' error even after updating customtkinter to 5.2.2. I am using python 3.10.4 and on linux operator. `#!/sw/freetools/python/3.10.4/rh70_64/bin/python import customtkinter

customtkinter.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light" customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"

def change_appearance_mode_event(new_appearance_mode: str): customtkinter.set_appearance_mode(new_appearance_mode)

app = customtkinter.CTk() app.title("\U0001F6FAmation Hub") app.geometry(f"{1024}x{480}")

app.grid_columnconfigure(1, weight=1) app.grid_columnconfigure((2, 3), weight=1) app.grid_rowconfigure((0, 1, 2), weight=1)

sidebar_frame = customtkinter.CTkFrame(app, width=140, corner_radius=0) sidebar_frame.grid(row=0, column=0, rowspan=4, sticky="nsew") sidebar_frame.grid_rowconfigure(4, weight=1)

logo_label = customtkinter.CTkLabel(sidebar_frame, text="Automation\nHub", font=customtkinter.CTkFont(size=24, weight="bold")) logo_label.grid(row=0, column=0, padx=20, pady=(20, 10))

appearance_mode_label = customtkinter.CTkLabel(sidebar_frame, text="Appearance Mode:", anchor="w") appearance_mode_label.grid(row=5, column=0, padx=20, pady=(10, 0)) appearance_mode_optionemenu = customtkinter.CTkOptionMenu(sidebar_frame, values=["Light", "Dark", "System"], command=change_appearance_mode_event) appearance_mode_optionemenu.grid(row=6, column=0, padx=20, pady=(0, 10))

app.mainloop() ` kindly help, Is there a way to use ctkinter in python 3.10.4 or do i have to update python also or is there some other issue?

JanPanthera commented 4 months ago

The error message _tkinter.TclError: unknown option "-angle" suggests that the issue might be related to a specific option being used in your code or within the customtkinter library that isn't recognized by the underlying Tcl/Tk version installed on your system. This could be due to an incompatibility between customtkinter and the Tcl/Tk version, rather than with Python itself.

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Verify Tcl/Tk Version: Ensure that the version of Tcl/Tk installed on your system is compatible with customtkinter. You can check the Tcl/Tk version used by Python with the following commands in a Python shell:

    import tkinter
    print(tkinter.Tcl().eval('info patchlevel'))

    Compare this version with the requirements or known compatible versions listed in the customtkinter documentation or release notes.

  2. Update Tcl/Tk: If the version of Tcl/Tk is outdated or known to have issues with customtkinter, consider updating it. On Linux, this can typically be done through your package manager.

  3. Check customtkinter Documentation: Look for any notes in the customtkinter documentation regarding compatibility issues or specific requirements for Tcl/Tk versions. There might be specific guidelines or workarounds for the issue you're encountering.

  4. Test with a Simple Example: Try running a minimal customtkinter example to see if the issue persists. This can help isolate the problem. If a simple example works, the issue might be with how a specific widget or option is used in your code.

  5. Search for Similar Issues: Look for similar issues in the customtkinter GitHub issues page or other forums. Someone else might have encountered the same problem, and a solution or workaround could already be available.

  6. Python Version: Although Python 3.10.4 should generally be compatible with customtkinter, you might consider testing your application with a different Python version (e.g., the latest Python 3.9.x or 3.11.x) in a virtual environment to rule out any Python version-specific issues.

  7. Report the Issue: If none of the above steps help, consider reporting the issue on the customtkinter GitHub page. Provide details about your environment, the Python and Tcl/Tk versions you're using, and a minimal code example that reproduces the error.

It's unlikely that you need to update Python itself specifically for customtkinter compatibility, but ensuring that all components (Python, Tcl/Tk, and customtkinter) are up to date is generally a good practice.

Generated by ChatGPT4 😸

absingh22 commented 4 months ago

My tcl/tk version is 8.5.13, and 8.5 version is known for having some issue, i'll try to upgrade it to 8.6 and will see what happens. Thank you so much for you input.

ps: even though its chatgpt generated😂

JanPanthera commented 4 months ago

i will tell ChatGPT a thank you from you xD