Problem

As in this example, move the Gtk.Scrolledwindow above the button. That is, place the Scrolledwindow in place of the button, and the button in place of the Scrolledwindow ( as indicated in the image )?

The button is located in the Gtk.Notebook object.

GTK 3

from gi.repository import Gtk as gtk from gi.repository import Gdk as gdk class app: def __init__(self): window_main = gtk.Window() window_main.set_size_request(gdk.Screen.get_default().get_width(),0) window_main.set_name("window_main") window_main.move(0,0) window_main.set_keep_above(True) window_main.set_resizable(False) window_main.set_decorated(False) window_main.set_border_width(0) window_main.connect("destroy",lambda e: gtk.main_quit()) box_main = gtk.HBox() scrolledwindow_categories = gtk.ScrolledWindow() scrolledwindow_categories.set_policy( gtk.PolicyType.AUTOMATIC, gtk.PolicyType.NEVER ) scrolledwindow_categories.set_size_request(20,20) viewport_categories = gtk.Viewport() viewport_categories.add(box_main) scrolledwindow_categories.add(viewport_categories) window_main.add(scrolledwindow_categories) notebook_categories = gtk.Notebook() box_main.add(notebook_categories) for i in range(20): button = gtk.Button("Button") notebook_categories.append_page(button,gtk.Label("Text")) window_main.show_all() gtk.main() app() 
  • Clarify the question Where should ScrolledWindow be located? Specify gtk version (gtk2 or gtk3)? - Yaroslav
  • Yes, and the use of Viewport with ScrolledWindow not necessary. As ScrolledWindow already contains Viewport . Viewport used with items that do not have scrolling. such as HBox - Yaroslav
  • @Yaroslav corrected. - CockLobster
  • By code, you create a Window , in the Window prevent ScrolledWindow in this object, a scrolling system is created, in ScrolledWindow prevent the Box object and in the Box object you interfere with the Notebook , and already in the Notebook You have a button. therefore, the scroll pane is at the bottom and with its help you can manipulate nested objects. Visually, you will not transfer it as the button is inside ScrolledWindow . Therefore, another question. What objects should be inside ScrolledWindow ? - Yaroslav
  • @Yaroslav better I will try to implement it without Scrolledwindow : through buttons and vadjustment . - CockLobster

0