To execute it, a simple python hello_world.py will do the work.
But that's not the whole story, the real question is: how to access the methods of a Qt class? To simplify the process, we kept Qt APIs. For example, if we want to specify the size of a QLabel, in C++ we will have something like:
QLabel *label = new QLabel();
If you are not familiar with Qt development, it is a common practice to extend a certain class and adapt it to our needs. In the previous example, we are using QWidget as a base class, and we included a QLabel and a QPushButton.
The application is really simple:
First, we write a list containing Hello World in many languages.
Then, we initialize a QPushButton and a QLabel with a certain alignment, font and size.
After that, we create a QVBoxLayout to include our objects, and we assign it to our class.
And finally, we connect the clicked() signal of our QPushButton to our method called magic.
As a result, every time we click the button, we will get a Hello World in a random language!
The structure of this simple script will be the base for most of the applications using Qt for Python, and we encourage you to test it as soon as Qt for Python is out!