TomSchimansky / CustomTkinter

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

CTkTextBox - Returns error "_tkinter.TclError: unknown option "-angle"" #1818

Open jacobranz opened 1 year ago

jacobranz commented 1 year ago

When running in a closed environment I get an error relating to the subject above. I did not have this issue when running on a machine connected to the internet... I did not change any content of my script. Here are some more errors outputted when running, being that I cannot copy and paste the error I will do my best to transcribe!

File "reboot_prompt_custom_tk.py" line 38, in init self.textbox = customtkinter.CTkTextBox(self, width=150) File "/usr/local/lib/python3.10/site-packages/customtkinter/windows/widgets/ctk_textbox.py", line 123, in init self.draw() File "/usr/local/lib/python3.10/site-packages/customtkinter/windows/widgets/ctk_textbox.py", line 216, in _draw requires_recoloring = self._draw_engine.draw_rounded_rect_with_border(self._apply_widget_scaling(self._current_width)

There is more output, and I can transcibe more if needed, but I thought this might be enough to start! Thank you for any help you can provide!

### After further investigation, this only appears to be an issue on Linux. Anything that uses the self.draw method in particular, whehter that be for a text box, option menu, or tabview. None of them work when running on Linux, let me know if there may be anything I am missing!

jacobranz commented 1 year ago

I forgot to mention, I tested on a Windows machine. Then transferred to a Linux machine, where I am not seeing issues. Is there something I need to changed to account for OS difference?

ghost commented 1 year ago

@jacobranz - Please clarify, in the OP you mention the issue only appears to be on Linux, however, in a comment you say the issue doesn't occur on Linux?

ghost commented 1 year ago

Additionally, could you provide a minimal reproducible example? This would help us determine if the issue has to do with versions of Python, CTk, etc.

jacobranz commented 1 year ago

I apologize, that may have been a bit unclear. Initially I was only running on Windows, which works just fine. However, when I ran it on Linux, that was when I began to see issues.

And of course, would you like me to provide a code snippet that is failing?

ghost commented 1 year ago

No worries :) thanks for clarifying. Could you provide a code snippet as well as the full traceback? I'm on macOS by the way.

jacobranz commented 1 year ago

It might be a bit difficult to give you traceback/errors since I am running the script on a disconnected network... But here is the code snippet to start, if that turns out not to be enough, I can just transcribe the error by hand.

`

    self.textbox = customtkinter.CTkTextbox(self, width=150)
    self.textbox.grid(row=0, column=1, padx=(20, 20), pady=(20, 0), sticky="nsew")
    self.textbox.insert("0.0", "IT kindly reminds you to reboot your machine at your earliest convenience!\n\nPer DoD guidelines, all machines are required to reboot after a time period of 7 days. Please comply with this policy as soon as possible. This prompt will continue to appear every hour until a reboot all pending reboots have been resolved.\n\n Any questions or concerns can be addressed to the IT department.")

    # create tabview
    self.tabview = customtkinter.CTkTabview(self, width=250)
    self.tabview.grid(row=2, column=1, padx=(20, 20), pady=(20, 20), sticky="nesw")
    self.tabview.add("Reboot")
    self.tabview.add("Notification Info")
    self.tabview.tab("Reboot").grid_columnconfigure(0, weight=1)  # configure grid of individual tabs
    self.tabview.tab("Notification Info").grid_columnconfigure(0, weight=1)

`

ghost commented 1 year ago

Running the following code:

import customtkinter

class App(customtkinter.CTk):
    def __init__(self):
        super().__init__()

        self.textbox = customtkinter.CTkTextbox(self, width=150)
        self.textbox.grid(row=0, column=1, padx=(20, 20), pady=(20, 0), sticky="nsew")
        self.textbox.insert("0.0", "IT kindly reminds you to reboot your machine at your earliest convenience!\n\nPer DoD guidelines, all machines are required to reboot after a time period of 7 days. Please comply with this policy as soon as possible. This prompt will continue to appear every hour until a reboot all pending reboots have been resolved.\n\n Any questions or concerns can be addressed to the IT department.")

        # create tabview
        self.tabview = customtkinter.CTkTabview(self, width=250)
        self.tabview.grid(row=2, column=1, padx=(20, 20), pady=(20, 20), sticky="nesw")
        self.tabview.add("Reboot")
        self.tabview.add("Notification Info")
        self.tabview.tab("Reboot").grid_columnconfigure(0, weight=1)  # configure grid of individual tabs
        self.tabview.tab("Notification Info").grid_columnconfigure(0, weight=1)

app = App()
app.mainloop()

On macOS 12.6.7, Python 3.11.4, and CustomTkinter 5.2.0, I get absolutely no errors/traceback. I get the following results:

Screen Shot 2023-07-17 at 2 31 29 PM Screen Shot 2023-07-17 at 2 31 34 PM

Please provide the full traceback. Not sure why the error doesn't show up on my end. Also provide your versions of Python and CustomTkinter through the following commands:

python -V
pip show customtkinter

(or python3 and pip3 for Linux)

jacobranz commented 1 year ago

Yeah that makes sense, I am really only seeing this issue on RHEL. Let me see if I can get you the traceback, I will also try and replicate this issue on a RHEL server connected to the internet as well.

ghost commented 1 year ago

Let me know the results. thanks!

Does the error show up on Windows?

Maybe try running the example programs provided in this repo.

jacobranz commented 1 year ago

Will do, working on it now:) And no, it works on Windows.

ghost commented 1 year ago

Either a CTk issue on a specific OS/distro or maybe the Python and tkinter version?