I'm trying to add an icon to "Gtk.StackSidebar" and I can't (Gtk4 & Python)

            sidebar = Gtk.StackSidebar()
            stack = Gtk.Stack()
            label = Gtk.Label()
            label.set_label("Page N 01")
            stack.add_named(label, "name");
            stack_page = stack.get_page(label)
            icon = "document-new-symbolic"
            stack_page.set_property("icon-name", icon)
            # stack_page.set_icon_name(icon)

GtkStackSidebar cannot show an icon: Add Icon to GtkStackSidebar (#720) · Issues · GNOME / gtk · GitLab

Note that even for GtkStackSwitcher, it shows only the icon, not both the icon and the title: GtkStackSwitcher can't show page icon with label (#4652) · Issues · GNOME / gtk · GitLab

You might find something you can use in libadwaita.

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.