You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
768 B

8 months ago
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
import numpy as np
from PySide6.QtCore import *
from PySide6.QtGui import *
# Pyinstaller i src/sudo32.png -F main.py
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
# 创建两个按钮并设置名字
self.button1 = QPushButton("Button 1", self)
self.button1.setObjectName("button1")
self.button2 = QPushButton("Button 2", self)
self.button2.setObjectName("button2")
# 根据名字查找按钮控件并修改文本
button = self.findChild(QPushButton, "button1")
button.setText("aaa")
if __name__ == "__main__":
app = QApplication([])
window = MyWindow()
window.show()
app.exec_()