Take the 2-minute tour ×

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)

share|improve this question
add comment

2 Answers

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

share|improve this answer
+1 for providing best practices, along with the solution. –  Jonah Mar 3 '13 at 4:31
add comment

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>

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


    return 0;
share|improve this answer
add comment

Your Answer


