Python PyQt5 Install Windows & Linux

by Atakan

Hi
i am starting graphical interface programming articles with Python.
PyQt5 library will help us in this matter

Let’s download PyQt5, which is the gui library we will use first.
For this, we will use the pip download manager that comes with it when installing python.

If I should mention PyQt, it is a cross-platform gui libraria for short. It is available for free. For more details https://en.wikipedia.org/wiki/PyQt
and official website https://www.riverbankcomputing.com/software/pyqt/intro

Let’s install by running this command.

pip install PyQt5

Let’s test it now.
Open PyCharm or IDLE or another python editor you use and let’s test it as follows.

from PyQt5.QtWidgets import QApplication, QWidget
import sys

W_WIDTH = 400
W_HEIGHT = 150
W_X = 400
W_Y = 150


def create_window():
    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(W_WIDTH, W_HEIGHT)
    w.move(W_X, W_Y)
    w.setWindowTitle('www.langpy.com | Python GUI Tutorial')
    w.show()

    sys.exit(app.exec_())

create_window()

Result

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. OK Read More