문제

In my layout, I use a ton of box layouts. In most tutorials I looked, people would use HBox and VBox's. I didn't think that a Box would be that much different.

The GtkBuilder chokes miserably anytime I have a Box layout in the Glade file, giving me the following error message:

Gtk:ERROR:/build/buildd/gtk+3.0-3.6.0/./gtk/gtknotebook.c:1235:gtk_notebook_buildable_add_child: assertion failed: (page != NULL)

I've looked this up, and the best response they had was to revert back to Glade 3.8. I don't want to do that because Glade 3.8 was designed for GTK+ 2, and I want to develop for GTK+ 3 (I'm really liking the Gnome shell interface). Thus, I'm trying to stick with 3.14.

Is there another version of GtkBuilder that supports the new Box layout? It just seems odd that the Glade developers would break their support like that without updating the corresponding GtkBuilder object.

Here's the Python code that creates the interface:

from gi.repository import Gtk

class MainWindow(object):

    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file('main-window.glade')

        self.window = self.builder.get_object('mainWindow')

        self.builder.connect_signals(self)

Any help or advise is much appreciated!

도움이 되었습니까?

해결책

Thank to gpoo for helping me in figuring this out:

Make sure to read your error messages! I had a GtkNotebook with blank pages, which made the GtkBuilder complain. So no blank pages.

Also, GtkBox works just fine in all its permutations (at least the Python interface, anyway).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top