How to create a custom widget?

,

I’m trying to create a custom Gtk.Widget with it’s own set of properties+methods. My plan is to create a Gtk.Tab widget that can hold a Gtk.StackDwitcher/ Gtk.SideBar and a Gtk.Stack. Now it’s fairly straightforward if I just subclass a Gtk.Box and add those widgets. It works but I don’t want to expose ƒ append/ƒ prepend etc. on any of the subclass instances.

For example, a Gtk.Button can add child with child/ƒ set_child. This way it can impose adding only a single child. I’m trying to get this kind of behaviour so that I can add only some specific widget (i.e. tab/ƒ set_tab to set Gtk.StackSwitcher or Gtk.StackSidebar, content/ƒ set_content to add Gtk.Stack) and restrict adding any further widgets using ƒ append/ƒ prepend.

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