tobias47n9e
tobias47n9e

Reputation: 2231

Create Gtk toolbar with buttons and text in PyGobject

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?

Upvotes: 0

Views: 345

Answers (1)

ptomato
ptomato

Reputation: 57870

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

Upvotes: 1

Related Questions