forked from alejandroautalan/pygubu-designer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helloworld.py
30 lines (21 loc) · 740 Bytes
/
helloworld.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
# helloworld.py
import pathlib
import pygubu
PROJECT_PATH = pathlib.Path(__file__).parent
PROJECT_UI = PROJECT_PATH / "helloworld.ui"
class HelloworldApp:
def __init__(self, master=None):
# 1: Create a builder and setup resources path (if you have images)
self.builder = builder = pygubu.Builder()
builder.add_resource_path(PROJECT_PATH)
# 2: Load an ui file
builder.add_from_file(PROJECT_UI)
# 3: Create the mainwindow
self.mainwindow = builder.get_object("mainwindow", master)
# 4: Connect callbacks
builder.connect_callbacks(self)
def run(self):
self.mainwindow.mainloop()
if __name__ == "__main__":
app = HelloworldApp()
app.run()