first application using PySide2
when developer starts with new framework, he print out "hello world". I think it's very good start point. because, we can see the structure of the framework at glance.
so, I will make the application to print out "hello world" using pyside2.
just code above lines. then, run this code. then, you can see below screen that present "hello world".
in order to start pyside2 application, we have to import what we will use. in this example application, I used QLabel and QApplication. QLabel is a Widget that present text data.
after importing, we have to create application object. and we can pass any parameter to the parameter of QApplication constructor. if you don't need any parameter, you can pass empty list object like below.
after creating application object, we have to make any widget. in this example, I made QLabel widget and I show the widget with "hello world" text.
finally, we have to call "exec_()" method of QApplication object. then, Qt main loop will run and execute Qt code.
so, I will make the application to print out "hello world" using pyside2.
import sys from PySide2.QtWidgets import QApplication, QLabel app = QApplication(sys.argv) label = QLabel("Hello World!") label.show() app.exec_()
just code above lines. then, run this code. then, you can see below screen that present "hello world".
in order to start pyside2 application, we have to import what we will use. in this example application, I used QLabel and QApplication. QLabel is a Widget that present text data.
after importing, we have to create application object. and we can pass any parameter to the parameter of QApplication constructor. if you don't need any parameter, you can pass empty list object like below.
app = QApplication([])
after creating application object, we have to make any widget. in this example, I made QLabel widget and I show the widget with "hello world" text.
finally, we have to call "exec_()" method of QApplication object. then, Qt main loop will run and execute Qt code.
Comments
Post a Comment