PySide2 GUI
这个自动化脚本将帮助你使用 PySide2 Gui 模块创建你的 GUI 应用程序。你可以在下面找到开始开发体面的现代应用程序所需的每种方法。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
from PySide6.QtWidgets import * from PySide6.QtGui import * import sys app = QApplication(sys.argv) window = QWidget()
window.resize(500, 500)
window.setWindowTitle("PySide2 Window")
button = QPushButton("Click Me", window) button.move(200, 200)
label = QLabel("Hello Medium", window) label.move(200, 150)
input_box = QLineEdit(window) input_box.move(200, 250) print(input_box.text())
radio_button = QRadioButton("Radio Button", window) radio_button.move(200, 300)
checkbox = QCheckBox("Checkbox", window) checkbox.move(200, 350)
slider = QSlider(window) slider.move(200, 400)
progress_bar = QProgressBar(window) progress_bar.move(200, 450)
image = QLabel(window) image.setPixmap(QPixmap("image.png"))
msg = QMessageBox(window) msg.setText("Message Box") msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) window.show() sys.exit(app.exec())
|