简体   繁体   English

更改gtk.Paned句柄大小

[英]change gtk.Paned handle size

gtk.Paned包含一个名为'handle-size'的样式属性,我假设它将改变句柄的大小,它是只读的,所以我该如何改变呢?(在PyGtk中)

From the documentation for gtk.Widget : gtk.Widget的文档:

gtk.Widget introduces style properties - these are basically object properties that are stored not on the object, but in the style object associated to the widget. gtk.Widget引入了样式属性 - 这些属性基本上是对象属性,不存储在对象上,而是存储在与窗口小部件关联的样式对象中。 Style properties are set in resource files . 样式属性在资源文件中设置。 This mechanism is used for configuring such things as the location of the scrollbar arrows through the theme, giving theme authors more control over the look of applications without the need to write a theme engine in C. 此机制用于配置诸如滚动条箭头在主题中的位置之类的内容,使主题作者能够更好地控制应用程序的外观,而无需在C中编写主题引擎。

The general practice in GTK is not to set style properties from your program, but just use the standard UI widgets and let the user decide how they should look (by means of a desktop theme). GTK的一般做法不是从程序中设置样式属性,而只是使用标准UI小部件并让用户决定它们的外观(通过桌面主题)。

You can feed a custom resource file before starting your own application. 您可以在开始自己的应用程序之前提供自定义资源文件。 In C (hopefully the translation to python is straightforward) that would be: 在C(希望翻译到python是直截了当的)将是:

#include <gtk/gtk.h>

int
main(gint argc, gchar **argv)
{
    GtkWidget *window;
    GtkPaned  *paned;

    gtk_init(&argc, &argv);

    gtk_rc_parse_string("style 'my_style' {\n"
                        "    GtkPaned::handle-size = 200\n"
                        " }\n"
                        "widget '*' style 'my_style'");

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    paned = (GtkPaned *) gtk_hpaned_new();
    gtk_paned_add1(paned, gtk_label_new("left"));
    gtk_paned_add2(paned, gtk_label_new("right"));

    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(paned));

    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}

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

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