Python PyAutoGUI Script to Execute Shell Commands in GUI and Show the Result in Popup Window Desktop App Full Project For Beginners
Welcome folks today in this post we will be executing
shell commands in pyautogui
library using python. All the full source code of the application is shown below.
Get Started
In order to get started you need to install the following library using the pip
command as shown below
pip install pyautogui
After installing this library make an app.py
file and copy paste the following code
app.py
# import required modules
import os
import pyautogui
# prompts message on screen and gets the command
# value in val variable
value = pyautogui.prompt("Enter Shell Command")
# executes the command and returns
# the output in stream variable
stream = os.popen(value)
# reads the output from stream varible
out = stream.read()
pyautogui.alert(out)
And now if you execute the above script
by typing the below command
python app.py
Now you can see that we are entering the shell command inside the gui
to print the version of node
and then inside the popup window it it printing out the result of shell
command which is the version of nodejs which is v12.16.3
installed on my machine