from PyQt5.QtWidgets import QApplication, QWidget, QLabel import sys app = QApplication(sys.argv) widget = QWidget() label = QLabel("Hello World!", widget) label.move(50, 50) widget.show() sys.exit(app.exec_())
from PyQt5.QtWidgets import QApplication, QWidget, QLabel import sys app = QApplication(sys.argv) widget = QWidget() label = QLabel("In this example, we create a QLabel instance and set its text property to an HTML-formatted string. The label will display the text "Hello, World!" in a larger font with the word "World!" in italics. We again move the label to the position (50, 50) within the parent widget, show the widget, and start the application event loop.Hello, World!
", widget) label.move(50, 50) widget.show() sys.exit(app.exec_())