Closed mctinker closed 1 week ago
@mctinker Could you please provide Sample Reproducible Code?
The following is my function to display the progress bar... `def display_progress_bar( progress: dict, is_instance_method: bool = False, ) -> None: """ Update and display a progress bar with a specified color based on the progress percentage.
Args:
progress (dict): The dictionary containing the progress bar details.
is_instance_method (bool): Flag to determine if the function is used as a class instance method.
Returns:
None: This function does not return anything.
"""
progress_bar = progress["progress_bar"]
tenth_increment = progress["tenth_increment"]
progress_counter = progress["progress_counter"]
max_data = progress["max_data"]
# If used as an instance method (Map), adjust the progress_bar reference.
if is_instance_method:
progress_bar = progress["progress_bar"].progress_bar
comp2 = 2
comp4 = 4
comp6 = 6
comp8 = 8
threshold = progress_counter / tenth_increment
else:
# Diagram view
comp2 = tenth_increment * 2
comp4 = tenth_increment * 4
comp6 = tenth_increment * 6
comp8 = tenth_increment * 8
threshold = progress_counter
# Calculate our progress value based on the maximum value and current value.
progress_value = round((progress_counter / max_data), 2)
# Determine the progress color based on the current value.
if threshold <= comp2:
progress_color = "red"
elif threshold <= comp4:
progress_color = "orangered"
elif threshold <= comp6:
progress_color = "orange"
elif threshold <= comp8:
progress_color = "limegreen"
else:
progress_color = "green"
# If value is over .99, for some reason the progress bar users a value of .02 ratherr than 1.
# So we have to force it to something just short of 1.
if progress_counter / max_data >= 0.99:
progress_value = 0.97
# Update the progress bar with the current value and color.
progress_bar.progressbar.set(progress_value). # <<<<<<<< ERROR >>>>>>>>>
progress_bar.progressbar.configure(progress_color=progress_color)
progress_bar.progressbar.update()`
While tcl-tk changed how the progress bar is handled, I was able to work around this change and get it working again. I am closing this as fixed.
Having upgraded to Tcl-tk v9.0.0.1, I now get the following error when encountering the Python line:
progress_bar.progressbar.set(progress_value)
invalid command name "4363536704_internal_loop" while executing "4363536704_internal_loop" ("after" script) You can ignore the error message: 'IMKClient Stall detected, please Report...' Exception in Tkinter callback Traceback (most recent call last): File "/Users/mikrubin/.pyenv/versions/3.12.7/lib/python3.12/tkinter/init.py", line 1968, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/ctk_button.py", line 554, in _clicked self._command() File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/userintr.py", line 3169, in diagramevent = mapit_all("") ^^^^^^^^^^^^^ File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/mapit.py", line 710, in mapit_all special_handling(found_tasks, projects_without_profiles, projects_with_no_tasks) File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/mapit.py", line 632, in special_handling display_back_matter( File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/mapit.py", line 495, in display_back_matter process_outline() File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/mapit.py", line 400, in process_outline outline_the_configuration() File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/outline.py", line 609, in outline_the_configuration network_map(network) File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/diagram.py", line 1481, in network_map build_network_map(network) File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/diagram.py", line 1417, in build_network_map PrimeItems.netmap_output = handle_calls(PrimeItems.netmap_output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/diagram.py", line 1205, in handle_calls output_lines = cleanup_diagram(output_lines, progress) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/diagram.py", line 1095, in cleanup_diagram display_progress_bar(progress, is_instance_method=False) File "/Users/mikrubin/Library/CloudStorage/GoogleDrive-mikrubin@gmail.com/My Drive/Python/maptasker/maptasker/src/guiutils.py", line 1984, in display_progress_bar progress_bar.progressbar.set(progress_value) File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/ctk_progressbar.py", line 245, in set self._draw(no_color_updates=True) File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/ctk_progressbar.py", line 128, in _draw requires_recoloring = self._draw_engine.draw_rounded_progress_bar_with_border(self._apply_widget_scaling(self._current_width), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/core_rendering/draw_engine.py", line 718, in draw_rounded_progress_bar_with_border return self.__draw_rounded_progress_bar_with_border_polygon_shapes(width, height, corner_radius, border_width, inner_corner_radius, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/core_rendering/draw_engine.py", line 727, in draw_rounded_progress_bar_with_border_polygon_shapes requires_recoloring = self.draw_rounded_rect_with_border_polygon_shapes(width, height, corner_radius, border_width, inner_corner_radius) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/mikrubin/Library/Caches/pypoetry/virtualenvs/maptasker-DP8Ceg2U-py3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/core_rendering/draw_engine.py", line 155, in draw_rounded_rect_with_border_polygon_shapes self._canvas.delete("border_parts") File "/Users/mikrubin/.pyenv/versions/3.12.7/lib/python3.12/tkinter/init__.py", line 2908, in delete self.tk.call((self._w, 'delete') + args) _tkinter.TclError: invalid command name ".!ctkprogressbar.!ctkcanvas"
Commenting out 'progress_bar.progressbar.set(progress_value)' avoids the error (but then I don't get my progress bar.