Tag Archives: PyQt

pyqt5 hello world

Make a graphical interface with PyQt? Graphical interfaces made with PyQt run on: Microsoft Windows, Apple Mac OS X and Linux. We will create a Hello World app with PyQt. Install PyQt PyQt is available for both Python 2 (2.7.9 tested) and Python 3. To install write: pip3 install pyqt5 With apt-get you can use: […]

pyqt5 message box

When creating a Python GUI, you may want to show a message box at some point. Pyqt comes with messagebox support in both PyQt4 and PyQt5. The class to be used is QMessageBox. In this tutorial you’ll learn how to show a message box on buton click. QMessageBox example Import QMessageBox from the PyQt5 widgets […]

pyqt5 tooltip

A tooltip is a hint in a graphical interface. Tooltips frequently appear when hovering the mouse over a widget (without clicking). Pyqt supports tool tips, they can be configured for widgets. Note: Tooltips are not shown on mobile devices because there’s no mouse cursor. Pyqt5 tooltip A tooltip can be set using a widgets setTooltip […]

PyQt line edit

In this tutorial we’ll make an app that displays an input field. A textbox or LineEdit can be created using the QLineEdit class. Many applications have text inputs like form fields and the like. Introduction Start by importing the QLineEdit widget:

We will also add a text label, to show the user what to […]

pyqt5 sliders

PyQt5 comes with sliders out of the box. Sliders can be either vertical or horizontal. We can connect them with a method the same way as we do with buttons. A slider is often used in conjunction with a spinbox, QSpinBox. In this example we won’t use a spinbox, as that’s optional. You can connect […]

pyqt textarea

QPlainTextEdit is a multiline text area in PyQt. To set the text, we use its method insertPlainText(). We can set its position and size using the methods move() and resize(). Textarea The example below creates a text area using PyQt5. We will create the usual QMainWindow to add the widget to. It is just for […]

pyqt checkbox

A checkbox can be created using the QCheckBox widget. When creating an new checkbox with the QCheckBox class, the first parameter is the label. To apply actions to the toggle switch, we call .stateChanged.connect() followed by a callback method. When this method is called, it sends a boolean as state parameter. If checked, its the […]

pyqt combobox

A combobox can be created with the QComboBox class. Items are added using the class method addItem, followed by a string parameter. Sometimes its called a listbox, as it shows a list of items a user can select from. If you want a user to choose from a set of items, the listbox is the […]

pyqtgraph bar chart

The module pyqtgraph supports all kinds of charts and scientific graphics. Underneath, pyqtgraph uses PyQt4 / PySide and numpy. Its been tested to work on Linux, Windows, and OSX. In this article we’ll create an example bar chart. The output will be this awesome chart: pyqtgraph barchart We create the data to plot (x y1) […]