سؤال

I have a scrolledwindow as part of an application I've designed in Glade. I don't want to create the child object in Glade though, I want to create it and add it in the code directly.

When I try to do this though, I get a weird result where the whole scrolledwindow is just blank.

enter image description here

Here I've added a TreeView widget, but the same thing happens if I add a TextView, or presumably something else. You can see the scrollbars on the sides, so I'm sure rows are getting added.

Here's what it looks like when I add a TreeView widget in Glade.

enter image description here

There's nothing there, because I didn't add anything to it, but it's more like what you'd expect. A blank window.

Is there some setting I'm missing so that I can just leave it childless?

هل كانت مفيدة؟

المحلول

I found out that if I call scrolledwindow.hide() before I add a child, it works. So something like

self.scrolled_window = builder.get_object('scrolledwindow1')
self.scrolled_window.hide()
tv = gtk.TreeView()
self.scrolled_window.add(tv)
self.scrolled_window.show_all()

will work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top