先安装pyside
yay -S pyside2
windows可以
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyside2
# This Python file uses the following encoding: utf-8
import sys
from PySide2.QtWidgets import QApplication, QWidget,QMainWindow,QPushButton,QPlainTextEdit,QMessageBox
def handleCalc():
info = textEdit.toPlainText()
QMessageBox.about(window, '标题','hello world')
if __name__ == "__main__":
app = QApplication([])
window = QMainWindow()
window.resize(600,400)
window.move(300,300)
window.setWindowTitle("hello Window")
textEdit = QPlainTextEdit(window)
textEdit.setPlaceholderText("hello textEdit")
textEdit.move(10,25)
textEdit.resize(300,350)
button = QPushButton("弹出", window)
button.move(380,80)
button.clicked.connect(handleCalc)
window.show()
sys.exit(app.exec_())