

To do so, add the following line to the init method. Now that we have everything, we just need to connect the QPushButton to the Form. We have access to the text by means of the QLineEdit. Our function just prints the contents of the QLineEdit to the python console. Our function will be a part of the Form, so you have to add it after the init function. So, we create the layout, add the widgets with addWidgetand finally we say that our Form will have our QVBoxLayout as its layout.įinally, we just have to add a function to our custom Form and connect our button to it.
QT PLATFORM PLUGIN WINDOWS PALADINS CODE
Add the following code to the init method, after creating the widgets. Qt comes with layout-support that helps you organize the widgets in your application. In mainyou can see that we are creating a Form object and showing it to the world. Also, the new setWindowTitle method just sets the title of the dialog window. In this case, we are subclassing QDialog to define a custom dialog, which we name as Form. You can create any class that subclasses PySide2 widgets. The only novelty here is the class definition. This stub is updated during the course of this tutorial, but you can use this stub as is if you need to. Let us just start with a simple stub that creates and shows a dialog.
QT PLATFORM PLUGIN WINDOWS PALADINS HOW TO
This tutorial shows how to build a simple dialog with some basic widgets.

