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
10
votes
1 answer

How to format the entries in Gtk.Entry

For example, the telephone format is +999 99 9999-9999. That is, the GtkEntry automatically add the characters (+,[space] and -) as the user types.
Matheus Saraiva
  • 1,144
  • 1
  • 11
  • 33
10
votes
4 answers

Python cannot install PyGObject

I try install pygobject by pip pip install --user PyGObject but I doesn't work: Collecting PyGObject Using cached pygobject-2.28.3.tar.bz2 Complete output from command python setup.py egg_info: Traceback (most recent call last): …
Newbie
  • 435
  • 2
  • 6
  • 13
10
votes
1 answer

GTK+ 3.0: How to use a Gtk.TreeStore with custom model items?

I'm trying to develop a GTK application in Python and I'm really stuck with the correct usage of a gtk.TreeStore. My main problem: I've already parsed some JSON and I have my own data structure which ist basically a Python list and two kinds of…
f4lco
  • 3,728
  • 5
  • 28
  • 53
10
votes
2 answers

How to draw a GdkPixbuf using GTK3 and PyGObject

I have a small application that uses a DrawingArea to draw a simple map using PyGObject and GTK3. I load a Pixbuf using from gi.repository import Gtk, GdkPixbuf pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("logo.png", 25, 25) and then try to…
gnirx
  • 197
  • 1
  • 1
  • 8
9
votes
2 answers

pango attributes with pygobject

I have the following code, that uses pygtk: attr = pango.AttrList() attr.change(pango.AttrSize(( 50 * window_height / 100) * 1000, 0, -1)) attr.change(pango.AttrFamily("Sans", 0, -1)) attr.change(pango.AttrWeight(pango.WEIGHT_BOLD, 0,…
Marco Biscaro
  • 1,208
  • 10
  • 17
9
votes
3 answers

Mysterious GObject warning: assertion `G_IS_OBJECT (object)' failed

I have a warning when I run my GTK (Python GObject introspection) application and I can't figure out its source. When the application is loading and I'm populating a GtkListStore, after the very first time I append a row, I get the following…
user626998
9
votes
2 answers

PyGObject on Windows

Over the last few days of headaches, I've found 3 possible methods to do this, all of which have issues. PyGObject's pip install fails due to a lack of Cairo and probably other dependencies. While this would be my preferred method, it would…
FierySwordswoman
  • 181
  • 1
  • 2
  • 7
9
votes
1 answer

Terminate GObject.Mainloop() threads together with main

I have the following two threads: myThread = threading.Thread(target=sender.mainloop.run, daemon=True) myThread.start() myThread2 = threading.Thread(target=receiver.mainloop.run, daemon=True) myThread2.start() The targets are GObject.Mainloop()…
Zorgmorduk
  • 1,265
  • 2
  • 16
  • 32
9
votes
1 answer

What is the non-deprecated way to display a stock icon in GTK3?

I'm assembling a GUI using PyGObject. This Python code works in context. I get a toolbar button with the stock "Open" icon. from gi.repository import Gtk # ... toolbar =…
aaaantoine
  • 900
  • 8
  • 19
9
votes
1 answer

cx_freeze PyGObject application on Linux

I have a simple PyGObject application: from gi.repository import Gtk class Window(Gtk.Window): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.set_border_width(5) self.button =…
Fenikso
  • 9,251
  • 5
  • 44
  • 72
9
votes
3 answers

What causes the different display behaviour for a GtkIconView between different GTK versions?

Pictures will explain the title: Under LMDE & Ubuntu 12.04 my GtkIconView looks like this - its correct in terms of the spacing between the icons: Under Ubuntu 12.10, 13.04 & Fedora 17 the same code displays as follows: N.B. - This is a rhythmbox…
fossfreedom
  • 2,903
  • 2
  • 19
  • 40
9
votes
2 answers

How can I find out whether a GSettings schema exists or not before attempting to use it?

If a GSettings schema exists and has been compiled, there is usually no problem reading from it. However, if it doesn't exist, an error is usually thrown which cannot be handled. Try this in a Python file or console: from gi.repository import…
Mendhak
  • 8,194
  • 5
  • 47
  • 64
9
votes
1 answer

Load GUI from a Glade with GtkSourceView in PyGObject

I'm trying to use a Glade file that has a GtkSourceView widget in PyGObject. I've wrote a little guide on how to start using the new GtkSourceView 3.0 in Glade: http://cjenkins.wordpress.com/2012/05/08/use-gtksourceview-widget-in-glade/ The problem…
Havok
  • 5,776
  • 1
  • 35
  • 44
8
votes
4 answers

Create python object from memory address (using gi.repository)

Sometimes I need to call a gtk/gobject function that only exists in C, but returns an object that has a python wrapper. Previously I used a solution based on ctypes that worked well: http://faq.pygtk.org/index.py?req=show&file=faq23.041.htp Now that…
jdm
  • 9,470
  • 12
  • 58
  • 110
8
votes
3 answers

Introspection on pygtk3 possible?

One of the great things of python is the ability to have introspection on methods and functions. As an example, to get the function signature of math.log you can (in ipython) run this: In [1]: math.log? Type: builtin_function_or_method Base…
xubuntix
  • 2,333
  • 18
  • 19
1 2
3
54 55