-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
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:
- https://github.com/ExcaliburZero/dqmj1_info/tree/recompile_files
- https://github.com/ExcaliburZero/dqmj1_info/blob/recompile_files/extract_dqmj1_files.py
- https://github.com/ExcaliburZero/dqmj1_info/blob/recompile_files/recompile_dqmj1_files.py
- https://github.com/ExcaliburZero/dqmj1_info/blob/recompile_files/dqmj1_info/extract_files.py
- https://github.com/ExcaliburZero/dqmj1_info/blob/recompile_files/dqmj1_info/recompile_files.py
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 aExpected
- GUI opens
- User enters a value in the "value" field
- User clicks "Start"
- The output text displays "A"
- The program finishes
Actual
(Enter a value in the "value" field, and click "Start")
(Enter a value in the "value" field, and click "Start")
Running "Program B"
python example.py --value bExpected
- GUI opens
- User enters a value in the "value" field
- User clicks "Start"
- The output text displays "B"
- The program finishes
Actual
(Enter a value in the "value" field, and click "Start")