[Solved] Can't programmatically add widgets to containers

Hi, sorry if this is a n00b question, but here goes:

I’ve created simple GTK+ programs before, just Python scripts with widgets configured programmatically, which always worked without a hitch.

I’m now developing an app in GNOME Builder, and therefore I’m also using UI templates. After many hours of trying everything I can think of, I still can’t make my old code work with this setup. The templates render just fine, but I can’t add any widgets programmatically to any container type. It just doesn’t happen. No error messages, nothing.

What am I doing wrong?

The project I’m trying to get this to work in is here, and the line at which I’m trying to add a widget is here. If you run the app with GNOME Builder, just try to type in a search and hit the “find” button. That’s when the widgets fail to show up.


  • Fedora 33 (also tested on Ubuntu 20.04 in a VM)
  • GNOME Builder 3.38.2
  • Python 3
  • org.gnome.Platform 3.38

Any help is very highly appreciated. I feel like I’m almost there!

You didn’t show() those widgets?

Does the inspector list them?

As usual a sample code helps a lot. And as already pointed, did you call show method on them ?

I linked to the repo for the code, sorry if that was inconvenient. But yeah, I was just missing the show() call.

1 Like

D’oh. That’s what it was. Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.