Post #2774206
2026-02-16 11:51 UTC
@javalps@mastodon.social
Example was from window.py
So Gtk.Template.Child() retrieves the widget from the ui file using the name you have on the left. To make the window show up, you need to create a window based on that class, and present it:
```
win = GraphsWindow(application=self)
win.present()
```
See https://github.com/sstendahl/Graphs/blob/v1.5.0/src/main.py
Note this is an earlier version of Graphs. The latest main branch is a much better example of "good code". But the project was also simpler back then, so probably easier to get.
Replies (1)
-
@sstendahl@floss.social 2026-02-16 11:53
@javalps@mastodon.social Regarding the ui itself. You can create them using xml, which will line up with the adwaita documentation. Or use blueprint, which compiles the files into ui automatically. Blueprint is a bit more user friendly and easier to read. There's some docs here: https://gnome.pages.gitlab.gnome.org/blueprint-compiler/ But also here, for me I got furthest by just looking at examples and learning along the way. Which is a bit painful in the beginning but gets better over time.