Let Learn GUI with Python
PyQt5
https://pypi.org/project/PyQt5/
PyQt5 Documentation link
https://www.riverbankcomputing.com/static/Docs/PyQt5/
Download latest python from site (WINDOW 7 or Below)
https://www.python.org/downloads/
Now Open powerShell and start python
the path is
c:\users\ccare\appdata\local\programs\python\python38\lib\site-packages\
here my user name is ccare take not . you have different user name.
add below location to system environment
Start -> and type edit environment ->
Or download from Microsoft Store for Windows 10 user
C:\Users\ccare\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyqt5_tools\Qt\bin
Please note ccare is mine user name your username is different
make Shortcut to Desktop.
now add below location to path enviornment
For Linux System (Ubuntu 20.04)
open terminal
export PATH="/home/pmvanker/.local/bin:$PATH"
your username must be different mine is pmvanker
Now Open GUI Designer form Below Path
/home/pmvanker/.local/lib/python3.8/site-packages/pyqt5_tools/Qt/bin
Now We are Ready to Start First Demo Application
You can Use any python IDE like its your choice i list out
Pycham Community, Python IDE
We going to use Python IDE the Default IDE we downloaded
Now Demo Time
open Designer and select Main Window then create
add Push Button and change it title "print hello on terminal" and save it.
now go to the location where you save and open terminal.
line 22
self.pushButton.clicked.connect(self.print_msg)
line no 40
def print_msg(self):
print("Button Pressed")
so now again try to run
Demo Done.
For more infomation on PyQt5 Please read Documentation
https://www.riverbankcomputing.com/static/Docs/PyQt5/
Thank you
PyQt5
https://pypi.org/project/PyQt5/
PyQt5 Documentation link
https://www.riverbankcomputing.com/static/Docs/PyQt5/
Download latest python from site (WINDOW 7 or Below)
https://www.python.org/downloads/
Now Open powerShell and start python
the path is
c:\users\ccare\appdata\local\programs\python\python38\lib\site-packages\
here my user name is ccare take not . you have different user name.
add below location to system environment
Start -> and type edit environment ->
Or download from Microsoft Store for Windows 10 user
pip install PyQt5
pip install pyqt5-tools
C:\Users\ccare\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pyqt5_tools\Qt\bin
Please note ccare is mine user name your username is different
make Shortcut to Desktop.
now add below location to path enviornment
For Linux System (Ubuntu 20.04)
open terminal
sudo apt-get update sudo apt-get upgrade
sudo apt-get install python3
pip3 install pyqt5
pip3 install pyqt5-tools
Now open bashrc file and append below line
vim ~/.bashrc
your username must be different mine is pmvanker
pyuic5
Error: one input ui-file must be specifiedNow Open GUI Designer form Below Path
/home/pmvanker/.local/lib/python3.8/site-packages/pyqt5_tools/Qt/bin
Now We are Ready to Start First Demo Application
You can Use any python IDE like its your choice i list out
Pycham Community, Python IDE
We going to use Python IDE the Default IDE we downloaded
Now Demo Time
open Designer and select Main Window then create
add Push Button and change it title "print hello on terminal" and save it.
now go to the location where you save and open terminal.
pyuic5 -x print.ui -o print.py
Now You will see Print.py generated try to run it.python3 print.py
If you click on button nothing will print on terminal cause we are not connected the function we need to do some coding here close it. Open Print.pyline 22
self.pushButton.clicked.connect(self.print_msg)
line no 40
def print_msg(self):
print("Button Pressed")
so now again try to run
python3 print.py
if you click on the buttonDemo Done.
For more infomation on PyQt5 Please read Documentation
https://www.riverbankcomputing.com/static/Docs/PyQt5/
Thank you