简体   繁体   English

Gtk Notebook尺寸动态变化

[英]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. 我使用win.set_size_request(w,h)进行扩展。 How can I shrink dynamically? 如何动态缩小?

You can't force a GtkNotebook to shrink by using it's API. 您不能通过使用其API强制GtkNotebook缩小。 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. 如果Notebook内部的窗口小部件收缩,那么Notebook将收缩,尽管您可能需要考虑其他页面中的窗口小部件,但我不确定这是否可行。 You could wrap your GtkNotebook in a custom container that force the shrink on the notebook. 您可以将GtkNotebook包装在自定义容器中,以强制缩小笔记本的尺寸。

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. gtk_widget_set_size_request将仅设置小部件的最小尺寸,并覆盖其自然尺寸。

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. 您可能需要将页面的内容放在ViewPort或ScrolledWindow中才能获得所需的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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