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
| from PySide2.QtWidgets import * from PySide2.QtUiTools import QUiLoader from PySide2.QtCore import QFile from PySide2.QtGui import QIcon import PySide2.QtXml from threading import Thread, Lock from time import sleep import os.path as pa
res = '../Assets'
class Properties: def __init__(self): UI = QFile(pa.join(res, 'UI/mainWindow.ui')) UI.open(QFile.ReadOnly), UI.close() self.ui = QUiLoader().load(UI) self.window = self.ui.window() self.ui.button.clicked.connect(self.slot_sample)
def slot_sample(self): QMessageBox.about(self.window, 'about', 'hello world')
app = QApplication([]) app.setWindowIcon(QIcon(pa.join(res, 'Sprites/zt.jpg'))) prop = Properties() prop.window.show() app.exec_()
|