C:\Users\hmill\Pictures\TalentedCommunity_org\PyCharm
C:\Users\hmill\PycharmProjects\HM_python0927-1
../
install PyQt5 in PyCharm
https://pythonpyqt.com/how-to-install-pyqt5-in-pycharm/
Enter the cmd interface. Run the command and wait a moment.
pip install pyqt5 pyqt5-tools
The command is executed and PyQt5 is installed
..//
HMPy_Qt5_1.py
date 12/1/24
'''
#Test if pqyt5 is actually installed
#Create a new file, example.py, and enter the following code.
import sys
from PyQt5 import QtWidgets, QtCore
app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
widget.resize(400, 200)
widget.setWindowTitle("This is PyQt Widget example")
widget.show()
exit(app.exec_())
..//
Package
PyQt5
PyQt5-Qt5
PyQt5_sip
pip
Install PyQt5
Enter the cmd interface. Run the command and wait a moment.
pip install pyqt5 pyqt5-tools
The command is executed and PyQt5 is installed.
Test if pqyt5 is actually installed
Create a new file, example.py, and enter the following code.
../
import sys
from PyQt5 import QtWidgets, QtCore
app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
widget.resize(400, 200)
widget.setWindowTitle("This is PyQt Widget example")
widget.show()
exit(app.exec_())
../
from PyQt5.QtCore import pyqtSlot
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QDialog, QApplication
from PyQt5.uic import loadUi
import sys
class MainUI(QDialog):
def __init__(self):
super(MainUI, self).__init__()
loadUi('testQtUI.ui',self)
self.Return = 0
self.PBPress.clicked.connect(self.loadClicked)
@pyqtSlot()
def loadClicked(self):
self.TEXT.setText('welcome')
if __name__ == "__main__":
app = QApplication(sys.argv)
ui = MainUI()
ui.show()
app.exec_()
Adding third-party libraries
Stay in the Project Interpreter interface, click on the +, find and install pyqt5. pyqt5-sip, pyqt5-tools. After successful installation, the interface should look like this.
Configuring QtDesigner
Install designer
You can start designer directly from PyCharm. Make sure designer is installed first. Designer is not installed with the pip installation.
You can also do this:
pip install pyqt5-tools
Once qt5-designer is installed, you can configure it in PyCharm.
PyCharm select File | Settings | Tools | PyCharm. External Tools, click + New Tools, Create QTdesigner and PyUIC tools
Configuring QtDesigner
Install designer
You can start designer directly from PyCharm. Make sure designer is installed first. Designer is not installed with the pip installation.
You can also do this:
Once qt5-designer is installed, you can configure it in PyCharm.
PyCharm select File | Settings | Tools | PyCharm. External Tools, click + New Tools, Create QTdesigner and PyUIC tools
From code
Now that everything is setup, it’s time to test if everything is setup correctly.
Create a GUI interface using the code below (or any PyQt code).
from PyQt5 import QtWidgets # import PyQt5 widgets
import sys
# Create the application object
app = QtWidgets.QApplication(sys.argv)
# Create the form object
first_window = QtWidgets.QWidget()
# Set window size
first_window.resize(400, 300)
# Set the form title
first_window.setWindowTitle("The first pyqt program")
# Show form
first_window.show()
# Run the program
sys.exit(app.exec())
Select Run->Run first. You should see a PyQt window popup.
Basic GUI in Qt Designer with Push Button & Text Browser 1.1| Qt Designer with Pycharm
Basic GUI in Qt Designer with Push Button & Text Browser 1.1| Qt Designer with Pycharm
https://www.youtube.com/watch?v=rgN8sOWd8cg&list=PL8KMYMPQIOFrfj2xO0gx_DJE-ytqKSn53
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.uic import loadUi
import sys
class MainUI(QtWidgets.QMainWindow):
def __init__(self):
super(MainUI, self).__init__()
loadUi('HM_Qt-Designer-0927-1.ui')
if __name__ == "__main__":
app = QApplication(sys.argv)
ui = MainUI()
ui.show()
app.exec_()
C:\Users\hmill\PycharmProjects\HM_python0927-1\venv
C:\Users\hmill\AppData\Roaming\Python\Python312\site-packages\QtDesigner
PBPress
Basic GUI in Qt Designer with Push Button & Text Browser 1.1| Qt Designer with Pycharm
How to install PyQt5 in Pycharm
https://www.youtube.com/watch?v=7RDx-AocRMY
Open terminal from PyCharm (View -> Tools Windows -> Terminal) and type the following:
> python -m pip install pyqt5
python -m pip install pyqt5
python -m pip install pyqt5-dev-tools
python.exe -m pip install --upgrade pip