Let's say I have the following code
m_box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,4);
gtk_widget_set_halign (m_box, GTK_ALIGN_START);
gtk_widget_set_valign (m_box, GTK_ALIGN_START);
Now I am adding multiple widgets and running out of horizontal space. How can I make it responsive?
NOTE:- I am using gtk4
This is not something a GtkBox
can do. It's quite "dumb" in that it doesn't care about reflowing or anything like that. It does one thing and one thing only: putting child widgets next to each other in a specific orientation.
For your use case, you might be more interested in Gtk.FlowBox
, which rearranges its children when it can't allocate enough space