-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
33 lines (24 loc) · 822 Bytes
/
example.py
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
from PySide.QtCore import QFile
from PySide.QtGui import QWidget, QApplication
from PySide.QtUiTools import QUiLoader
def load_ui_widget(filename, parent):
loader = QUiLoader()
uifile = QFile(filename)
uifile.open(QFile.ReadOnly)
loader.load(uifile, parent)
uifile.close()
class ExampleApplication(QApplication):
def __init__(self, **kwargs):
super(ExampleApplication, self).__init__([], **kwargs)
def start(self):
self.exec_()
class ExampleWidget(QWidget):
def __init__(self, filepath):
super(ExampleWidget, self).__init__()
load_ui_widget("example.ui", parent=self)
self.setWindowTitle("PySide Example")
self.show()
if __name__ == "__main__":
app = ExampleApplication()
widget = ExampleWidget("example.ui")
app.start()