Questions tagged [pygobject]

GTK+ and other GObject bindings are provided by PyGObject through introspection.

Python library providing bindings for GObject based libraries through GObject-Introspection.

For more information:

817 questions
6
votes
3 answers

How to use gexiv2 in python?

I just compiled exiv2 and gexiv2 for my debian machiene and now I want to start working with gexiv2 to edit IPTC data using python. The gexiv2 website presents the following line of code: from gi.repository import GExiv2 But that already results…
JasonTS
  • 2,479
  • 4
  • 32
  • 48
6
votes
0 answers

Embeding python in Vala

I want to embed the Python interpreter into a program written in Vala to allow for some runtime scripting. I can run parts of my vala code from Python using Introspection, and I've found a rudimentary example of embedding the interpreter in Python…
ajg144
  • 61
  • 2
6
votes
1 answer

How to write custom Gtk.CellRenderer in python and GTK 3?

i must write my own cell renderer with button, i came up with this: #!/usr/bin/env python3 from gi.repository import Gtk class CellRendererButton(Gtk.CellRenderer): def __init__(self): Gtk.CellRenderer.__init__(self) def…
BPS
  • 1,133
  • 1
  • 17
  • 38
6
votes
1 answer

How to change the layout of a Gtk application on fullscreen?

I'm developing another image viewer using Python and Gtk and the viewer is currently very simple: it consists of a GtkWindow with a GtkTreeView on the left side displaying the list of my images, and a GtkImage on the right side, displaying the…
Jonathan Ballet
  • 973
  • 9
  • 21
6
votes
3 answers

How to connect to a GObject signal in python, without it keeping a reference to the connecter?

The problem is basically this, in python's gobject and gtk bindings. Assume we have a class that binds to a signal when constructed: class ClipboardMonitor (object): def __init__(self): clip = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) …
u0b34a0f6ae
  • 48,117
  • 14
  • 92
  • 101
6
votes
1 answer

Sending notifications with GObjects

There seems to be a distinct lack of documentation of the GObjects module for python at the moment, so maybe somebody can help me. I am making an application which occasionally will have to notify the user that an event has occurred. I have found…
Los Frijoles
  • 4,771
  • 5
  • 30
  • 49
6
votes
1 answer

Is there a way to unit test Gtk/GLib code written in Python?

I'm in the process of writing a small/medium sized GUI application with PyGObject (the new introspection based bindings for Gtk). I started out with a reasonable test suite based on nose that was able to test most of the functions of my app by…
robru
  • 2,313
  • 2
  • 29
  • 38
6
votes
1 answer

How do I set a Gtk.StatusIcon as Text

I'd like to create a Gtk.StatusIcon with custom text. Ideally I'd like to append this to an existing image, but text-only is ok, too. How can I achieve this? I've seen some posts about getting a Gtk.Label's pixbuf but those methods seem to be…
Massless
  • 151
  • 1
  • 3
5
votes
1 answer

Python & GTK3: How to create a Liststore

In PyGtk I always used this to create a ListStore with an Image (using it with an IconView for displaying files): store = gtk.ListStore(str, gtk.gdk.Pixbuf, bool) But I can't figure out how to do this with Python 3 and PyGObject.
jgillich
  • 71,459
  • 6
  • 57
  • 85
5
votes
2 answers

Python Gstreamer bindings with PyGObject Only has Core modules, no Plugins

I have gstreamer installed on OSX 12.0.1 Monterey. I just installed the python bindings inside of a virtual environment running python 3.9 with: pip3 install pycairo PyGObject I can import gi and gi.repository.Gst without an issue. However it seems…
Yllier123
  • 66
  • 14
5
votes
3 answers

python, GTK4, Gtk.ListStore.append and "AttributeError: 'ListStore' object has no attribute 'insert_with_valuesv'"

I'm new to coding and this is probably a stupid question... I'm setting up a simple Gtk.ListStore(str) but as soon as I append(['whatever']) I get a "AttributeError: 'ListStore' object has no attribute 'insert_with_valuesv'". I'm on Fedora 34(beta),…
5
votes
0 answers

How can I get the related Python type from a GType?

I'm building a GUI with GTK-3 in Python using Glade. There is also a ListStore with its columns defined in the Glade file. Now I want to fill the ListStore with numeric values (there are int & float columns) that I receive as strings, so I need to…
user2169513
  • 172
  • 1
  • 1
  • 11
5
votes
1 answer

How to install PyGObject in Anaconda on linux?

When importing PyGObject in my Anaconda Python3.7 installation, import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk I get following error message: ValueError: Namespace Gtk not available I installed pygobject and…
felixinho
  • 625
  • 7
  • 17
5
votes
1 answer

How to create PyGObject application with a menubar using Gtk.Builder?

There is no full documentation about how to use Gtk.Builder in PyGObject to create a menubar. I don't use that Gtk.UIManager because it is deprecated. The example code below is based on my experience with Gtk.UIManager. In the example should appear…
buhtz
  • 10,774
  • 18
  • 76
  • 149
5
votes
0 answers

How to use Python SecretStorage with GObject.timeout_add - Gtk3

I try to use SecretStorage in 2 Python processes, but when I try to update my Gtk.Window I get this message most of the time: RuntimeError: Unable to initialize SecretService: Did not receive a reply. Possible causes include: the remote…
oxidworks
  • 1,563
  • 1
  • 14
  • 37