[pygtk] Trying to use style from custom widget

Mike Bernson mike at mlb.org
Sat Sep 23 10:44:40 WST 2006


I have a custom widget that I want to use the style info from entry
widget. I have found a function  rc_get_style_by_path which look like
what I want to use. I am having problems getting it to return a style
object.

this is the code that I using to try and get the style info. It alway
print None. Can someone help be get the style info.

class PyEnum(gtk.Widget):

        __gproperties__ = {
                'enums': (gobject.TYPE_PYOBJECT, 'enums', 'enums data',
                        gobject.PARAM_READWRITE),
                'text': (gobject.TYPE_STRING, 'text', 'enums data', '',
                        gobject.PARAM_READWRITE),
                'width_chars': (gobject.TYPE_INT, 'width_chars', 'enums
data',
                        -1, 255, -1, gobject.PARAM_READWRITE),
                'xalign': (gobject.TYPE_FLOAT, 'xalign', 'enums data',
                        0.0, 1.0, 0, gobject.PARAM_READWRITE),
        }

        __gsignals__ = {
                'changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
(gobject.TYPE_STRING, gobject.TYPE_STRING))
        }


        def __init__(self):
                gtk.Widget.__init__(self)
                style = gtk.rc_get_style_by_paths(self.get_settings(),
                        'GtkEntry', 'GtkEntry', gobject.TYPE_NONE)
                print "style: %s %s" % (style, dir(style))


More information about the pygtk mailing list