Skip to content

GUI window recurses when defining more than one GUI in a module #917

@ExcaliburZero

Description

@ExcaliburZero

I ran into a bug where when defining two GUI programs in a module (to have external scripts call those functions to start the corresponding GUI) one of the 2 GUI applications will work file (maybe the one loaded first by Python?) but the other will open and ask the user to fill out the input fields but when they click "Start" a duplicate window will open and the processing part of the program will not run.

I put together a more minimal example below that I think reproduces the underlying issue, but has slightly different symptoms due to targeting a simpler use case.

For a better idea of the actual usecase, see my actual use case here:

Details

  • OS: Windows 10
  • Python Version: 3.12.5
  • Gooey Version: 1.0.8.1
  • Thorough description of problem
    • Expected Behavior: Creating a module with more than one gooey program should allow either gooey program to be invoked and work correctly.
    • Actual Behavior: Running a module with more than one gooey program results in one or both gooey programs endlessly recursing when clicking on the "Start" button. (see screenshots below)
  • A minimal code example:
import sys

import gooey


@gooey.Gooey(program_name="Program A")
def run_a():
   parser = gooey.GooeyParser()
   parser.add_argument("--value", required=True)
   parser.parse_args()

   print("A")


@gooey.Gooey(program_name="Program B")
def run_b():
   parser = gooey.GooeyParser()
   parser.add_argument("--value", required=True)
   parser.parse_args()

   print("B")


value = sys.argv[2]
if value.lower() == "a":
   run_a()
else:
   run_b()
  • Screenshot (if visual quirk): See below.

Running "Program A"

python example.py --value a

Expected

  • GUI opens
  • User enters a value in the "value" field
  • User clicks "Start"
  • The output text displays "A"
  • The program finishes

Actual

Capture_0001
(Enter a value in the "value" field, and click "Start")

Capture_0002
(Enter a value in the "value" field, and click "Start")

Capture_0003
Et cetera...

Running "Program B"

python example.py --value b

Expected

  • GUI opens
  • User enters a value in the "value" field
  • User clicks "Start"
  • The output text displays "B"
  • The program finishes

Actual

Capture_0004
(Enter a value in the "value" field, and click "Start")

Capture_0005
(Enter a value in the "value" field, and click "Start")

Capture_0006
Et cetera...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions