Question

I found a couple of tutorials (PyGTK) that use this code:

    from gi.repository import Gtk

    [...]

    self.toolbar = Gtk.Toolbar()
    self.toolbar.set_style(Gtk.TOOLBAR_BOTH)

    [...]

but using Python3 and GTK3 (PyGobject) I get the message:

AttributeError: 'gi.repository.Gtk' object has no attribute 'TOOLBAR_BOTH'

Does anyone know how to handle this in PyGobject?

Was it helpful?

Solution

Most likely Gtk.ToolbarStyle.BOTH; to convert a C constant to Python like GTK_TOOLBAR_BOTH which is a member of the GtkToolbarStyle enum, it's (module name).(enum name without module name).(constant name without enum prefix).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top