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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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_()