Instructions for creating a simple desktop app | PySide 6

DevNotes
By -
0


1. Sample code of a simple application

[code lang="python"]
import sys
from PySide6.QtWidgets import QApplication, QWidget

# Create an object that represents the app
app = QApplication(sys.argv)

# create main window using QWidget
window = QWidget()
window.setWindowTitle("My first pyside6 window") # đặt tiêu đề
window.resize(400, 300) # đặt kích thước

# Command Show window
window.show()

# Put the app into the event loop to call it to run continuously
sys.exit(app.exec())
[/code]
Result


2. Explain the components

QApplication is an instance for the entire app that manages the events loop
QWidget: represents UI elements (windows, buttons, ...)
sys.exit() : is a built-in function for safe exit in Python
app.exec(): execute loop calling app
Tags:
  • Older

    Instructions for creating a simple desktop app | PySide 6

Post a Comment

0 Comments

Post a Comment (0)
3/related/default