What combination of GTK widget is used for a scrollable column of widgets?

I am working with PyGTK trying to come up with a combination of widgets that will do the following:

  • Let me add an infinite number of widgets in a column
  • Provide a vertical scroll bar to jump to those that come out of the bottom
  • Set the width of the widget to fill the available horizontal space when the window is resized.

Thanks - I'm new to GTK.

+3
source share
2 answers
  • Infinite number of widgets in a column: similar to GtkVBox.
  • Vertical scrollbar: put your VBox in the GtkScrolledWindow window.
  • : VBox, ScrolledWindow . , Glade , , (, , ScrolledWindow).

. , , VBox , , . , VBox GtkViewport.

, ScrolledWindow (Viewport (VBox (widgets))).

+7

:

vbox = gtk.VBox()
vbox.pack_start(widget1, 1, 1) ## fill and expand
vbox.pack_start(widget2, 1, 1) ## fill and expand
vbox.pack_start(widget3, 1, 1) ## fill and expand
swin = gtk.ScrolledWindow()
swin.add_with_viewport(vbox)
0

Source: https://habr.com/ru/post/1702151/


All Articles