Lookslikerain75
Posts: 10
Joined: Wed Jul 17, 2019 6:29 pm

GUIZERO Button waits for process called to finish

Mon Nov 11, 2019 8:46 pm

I am calling a subprocess.run from a pushbutton, the issue I have is the button remains pressed down whilst the entire subprocess runs (10-15 seconds. I need the button to run the process but still let other processes run and not lock the entire window, so that the contents of a log file can update the value of a textbox. This all works but only after the subprocess called by the button completes.

Is this standard behaviour?

Thanks

User avatar
rpiMike
Posts: 985
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: GUIZERO Button waits for process called to finish

Tue Nov 12, 2019 10:29 am

You need to post your code for us to be able to help.

scotty101
Posts: 3753
Joined: Fri Jun 08, 2012 6:03 pm

Re: GUIZERO Button waits for process called to finish

Tue Nov 12, 2019 10:55 am

Are you using subprocess.run or subprocess.Popen?

Run will always wait, Popen can be configured to not wait.
See https://stackoverflow.com/questions/351 ... -dont-wait
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Lookslikerain75
Posts: 10
Joined: Wed Jul 17, 2019 6:29 pm

Re: GUIZERO Button waits for process called to finish

Wed Nov 13, 2019 10:36 am

subproccess.Popen solved the problem, much appreciated

Return to “Python”