简体   繁体   中英

Gtk Notebook size dynamically change

I have a notebook window. I want to change dynamically size. I did expand dynamically, but I couldn't shrink it. I used win.set_size_request(w,h) for expand. How can I shrink dynamically?

You can't force a GtkNotebook to shrink by using it's API. There are other ways of doing it. If the widget inside the Notebook shrinks, then the Notebook will shrink, although you might need to take into account the widgets in other pages, and I'm not sure this works. You could wrap your GtkNotebook in a custom container that force the shrink on the notebook.

And ... I can't think of any more ways of doing it. gtk_widget_set_size_request will set only the minimum size of the widget, overriding its natural size.

You likely have widgets on your pages that are stopping them from shrinking. You may need to put the content of your pages in a ViewPort or ScrolledWindow to get the effect you are looking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM