Improved GUI Responsiveness & Script Execution in Tkinter Interface #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@thynash
@Gagandeep-2003
Fixes: #26
Use sys.executable Instead of "python"
This ensures that subprocess runs in the same environment (especially useful when using virtual environments or Python 3+).
import sys
subprocess.call([sys.executable, "face-try.py"])
Prevent GUI Freeze with threading
Currently, when running subprocess.call(...), it blocks the GUI until the subprocess ends. To keep the GUI responsive, run each script in a separate thread.
from threading import Thread
def run_script(script_name):
def target():
subprocess.call([sys.executable, script_name])
Thread(target=target).start()
def face():
run_script("face-try.py")
def blink():
run_script("blinkDetect.py")
def lane():
run_script("lanedetection.py")
The current layout is functional but not visually centered. Using .grid(..., sticky='ew') or switching to pack() with better padding for cleaner UI.