tags:

views:

227

answers:

2

gtk.Paned contains a style property called 'handle-size' which i assume will change the size of the handle, it's read only, so how do i change it?(in PyGtk)

+1  A: 

From the documentation for 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. 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.

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).

ptomato
+1  A: 

You can feed a custom resource file before starting your own application. In C (hopefully the translation to python is straightforward) that would be:

#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;
}
ntd