Internal error while (re)rendering widgets

Open
#2,242 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
desktop

Research direction

Start by reproducing the error on Windows with overlapping widgets, resizing, or overflowing text, then trace the callback from windows/widgets/core_widget_classes/ctk_base_class.py into core_rendering/draw_engine.py and core_rendering/ctk_canvas.py. Confirm how the affected canvas coordinate updates behave in these cases. Done means the reported Tkinter callback error no longer occurs during those UI changes.

Written by the indexing model from the issue text.

Description

bug

customtkinter 5.2.2
Windows 10 Version 10.0.19045 Build 19045

I couldn't reliably reproduce the error, but it gets thrown occasionally whenever the UI dynamically changes, such as pressing a button or showing/hiding widgets.

Is is similar to #1006, but I am using no threads explicitly, but the .after() method.

Update: I've found out that the error gets thrown when wigets overlap when they shouldn't. Resizing my window or intentionally overflowing a text box can cause the error to be thrown reliably.

Traceback (most recent call last):
  File "\Lib\tkinter\__init__.py", line 1962, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_widget_classes\ctk_base_class.py", line 188, in _update_dimensions_event
    self._draw(no_color_updates=True)  # faster drawing without color changes
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\ctk_frame.py", line 110, in _draw
    requires_recoloring = self._draw_engine.draw_rounded_rect_with_border(self._apply_widget_scaling(self._current_width),
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\draw_engine.py", line 128, in draw_rounded_rect_with_border
    return self.__draw_rounded_rect_with_border_font_shapes(width, height, corner_radius, border_width, inner_corner_radius, ())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\draw_engine.py", line 285, in __draw_rounded_rect_with_border_font_shapes
    self._canvas.coords("inner_oval_1_a", border_width + inner_corner_radius, border_width + inner_corner_radius, inner_corner_radius)
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\ctk_canvas.py", line 87, in coords
    super().coords(coords_id, *args[:2])
  File "\Lib\tkinter\__init__.py", line 2836, in coords
    self.tk.splitlist(
TypeError: splitlist() argument must be encoded string without null bytes, not str
Exception in Tkinter callback
Traceback (most recent call last):
  File "\Lib\tkinter\__init__.py", line 1962, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_widget_classes\ctk_base_class.py", line 188, in _update_dimensions_event
    self._draw(no_color_updates=True)  # faster drawing without color changes
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\ctk_label.py", line 161, in _draw
    requires_recoloring = self._draw_engine.draw_rounded_rect_with_border(self._apply_widget_scaling(self._current_width),
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\draw_engine.py", line 128, in draw_rounded_rect_with_border
    return self.__draw_rounded_rect_with_border_font_shapes(width, height, corner_radius, border_width, inner_corner_radius, ())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\draw_engine.py", line 309, in __draw_rounded_rect_with_border_font_shapes
    self._canvas.coords("inner_rectangle_1", (border_width + inner_corner_radius,
  File "\Lib\site-packages\customtkinter\windows\widgets\core_rendering\ctk_canvas.py", line 99, in coords
    super().coords(tag_or_id, *args)
  File "\Lib\tkinter\__init__.py", line 2836, in coords
    self.tk.splitlist(
TypeError: splitlist() argument must be encoded string without null bytes, not str
Dominant language
Python
Stars
13.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TomSchimansky/CustomTkinter

All issues in TomSchimansky/CustomTkinter

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.