Home Ask Login Register

Developers Planet

Your answer is one click away!

mauek unak February 2016

Gtk how to add label item child

As a way how to learn Gtk and python I decided to re-write program which GUI was build in Glade (Gtk 2). I need a little push now, as I don't know how to make Hbox child item of Label ? Or maybe I just misunderstood it ? Here's how it looks in Glade:

Glade treeview

how to add Hbox into this piece of code ? :

    table1.attach(frame, 0, 2, 0, 1, gtk.FILL, gtk.FILL)
    notebook1.append_page(table1, label1)

    align = gtk.Alignment(0.5, 0.5, 1, 1)


jku February 2016

You can't really create the structure shown in the Glade screenshot: You can only add one child to a GtkFrame. I believe Glade is mistakenly showing you an internal child of the frame (the GtkAlignment that the frame itself uses to layout the possible frame label).

Don't add the GtkAlignment at all (use the GtkFrame API instead if you need to set the frame label alignment). Just create an HBox and add it into the Frame, then create a Label and pack it into the HBox.

Post Status

Asked in February 2016
Viewed 3,849 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life