Skip to content

Commit f83df9a

Browse files
committed
test(gui): make it easier to debug on windows
1 parent 6664120 commit f83df9a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ardupilot_methodic_configurator/frontend_tkinter_base.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ def __init__(self, root_tk: Optional[tk.Toplevel] = None) -> None:
380380
self.root = tk.Tk() # type: ignore[assignment]
381381
# Set the application icon for the window and all child windows
382382
# https://pythonassets.com/posts/window-icon-in-tk-tkinter/
383-
self.root.iconphoto(True, tk.PhotoImage(file=LocalFilesystem.application_icon_filepath())) # noqa: FBT003
383+
if not __debug__:
384+
self.root.iconphoto(True, tk.PhotoImage(file=LocalFilesystem.application_icon_filepath())) # noqa: FBT003
384385

385386
# Set the theme to 'alt'
386387
style = ttk.Style()
@@ -420,12 +421,15 @@ def put_image_in_label(parent: ttk.Frame, filepath: str, image_height: int = 40)
420421

421422
# Convert the image to a format that can be used by Tkinter
422423
try:
423-
photo = ImageTk.PhotoImage(resized_image)
424+
if __debug__:
425+
image_label = ttk.Label(parent)
426+
else:
427+
photo = ImageTk.PhotoImage(resized_image)
424428

425-
# Create a label with the resized image
426-
image_label = ttk.Label(parent, image=photo)
427-
# Keep a reference to the image to prevent it from being garbage collected
428-
image_label.image = photo # type: ignore[attr-defined]
429+
# Create a label with the resized image
430+
image_label = ttk.Label(parent, image=photo)
431+
# Keep a reference to the image to prevent it from being garbage collected
432+
image_label.image = photo # type: ignore[attr-defined]
429433
except TypeError as e:
430434
logging_error(_("Error loading %s image from file: %s"), filepath, e)
431435
image_label = ttk.Label(parent)

0 commit comments

Comments
 (0)