Questions tagged [pygobject]
GTK+ and other GObject bindings are provided by PyGObject through introspection.
pygobject
828
questions
62
votes
5
answers
37k
views
pygobject-2.28.6 won't configure: No package 'gobject-introspection-1.0' found, how do I resolve?
I'm trying to get pygobject-2.28.6 to compile in cygwin (version in repository is 2.28.4 which has some issues). Here is the tail of ./configure:
checking for GLIB - version >= 2.24.0... yes (...
47
votes
2
answers
110k
views
GtkDialog mapped without a transient parent
I have a GUI built in Glade (3.18) which is called by a Python 3 program (using PyGObject). I get a lot of warnings when running the program (Fedora 21) that say:
Gtk-Message: GtkDialog mapped ...
43
votes
2
answers
22k
views
What exactly are GLib and GObject?
I have been looking into the source code of python-mpdor and it mentions that it is
gobject-based, for easy event handling (in the high-level client
class).
Can someone explain to me in simple ...
41
votes
4
answers
8k
views
What's the recommended way to unittest Python GUI applications?
I'm currently foolish enough to try to maintaintain two parallel code bases for a Python desktop application, one using PyGObject introspection for GTK 3 and one using PyGTK for GTK 2. I work mainly ...
41
votes
1
answer
2k
views
How to create a letter spacing attribute with pycairo?
I'm using Pango + Cairo (through GObject) to render text with python3.7, and would like to set the letter spacing by creating an attribute and attaching that attribute to my pango layout.
In the gnome ...
29
votes
2
answers
9k
views
PyCharm can not resolve PyGObject 3.0, but code runs fine
I'm using PyCharm 2.5 on Ubuntu 11.10, trying to develop an application using PyGObject 3.0 on Python 3.2.2. I've installed the Ubuntu package python3-gobject, and when I run my code, it works exactly ...
27
votes
1
answer
4k
views
Has threading in GTK w/ Python changed in PyGObject introspection?
I'm in the process of converting a program from PyGTK to PyGObject introspection for the first time and I've hit a roadblock with threading. I have a process that takes some time to complete, so I pop ...
26
votes
5
answers
7k
views
PyGObject GTK+ 3 - Documentation?
PyGObject appears to have no real documentation. This tutorial is as close as it gets. I've been struggling all morning simply trying to find a description of the arguments accepted by the Gtk.Window ...
24
votes
3
answers
6k
views
How to bind a text domain to a local folder for gettext under GTK3
With gettext you can either use the default system-wide locale directory, or specify one yourself using bindtextdomain. This is useful when running a program directly from source when the compiled .mo ...
20
votes
1
answer
38k
views
ValueError: Namespace Gtk not available
When following the instructions 2. Getting Started — Python GTK+ 3 Tutorial 3.4 documentation
Tries
In [6]: import gi
...: gi.require_version('Gtk', '3.0')
...: from gi.repository import Gtk
...
18
votes
1
answer
15k
views
Can't import Webkit from gi.repository
When I try to import Webkit from gi.repository, it gives an ImportError:
from gi.repository import Webkit
ERROR:root:Could not find any typelib for Webkit
Traceback (most recent call last):
File "&...
18
votes
3
answers
7k
views
PyGObject in Python 3 on windows
Does anyone know if its possible to install PyGObject/Gtk+3 on windows for Python 3? I have found installers on gnome's website for Python 2 (here), and several statements that it works with Python 3 ...
17
votes
2
answers
34k
views
gi.repository Windows
I'm developing an app which has to be 100% compatible on windows and on linux. On linux I have no problems, but on windows I came up with this message:
from gi.repository import Gtk
ImportError: No ...
17
votes
1
answer
5k
views
How to center a window with PyGObject
I'm currently trying to center my application window, but it seems to be impossible with PyGObject (GTK+ 3). Indeed, with pyGTK, I was doing it this way:
window.set_position(gtk.WIN_POS_CENTER)
So ...
17
votes
2
answers
770
views
Non-ASCII symbols in translation of GTK-GUI in Windows not working?
I have a small python program that shows how to do translations of GTK (pygobject) GUIs for Linux and Windows. Everything works in Linux, but in Windows non-ASCII symbols are not rendered in the ...
15
votes
4
answers
10k
views
I'm completly confused with PyObject, PyGTK and GNOME 3 as well
I installed Fedora 15 to use Python3 and GObject to develop a desktop-application, because PyGTK looks outdated:
PyGTK 2.24.0 released
Friday 01 April 2011 by Rafael Villar Burke
PyGTK 2.24.0 ...
14
votes
2
answers
4k
views
How can I get the default colors in GTK?
Context
In GTK 3, people can set their own themes. Even the default theme (Adwaita) is provided with two variants: a light one and a dark one. As I am writing my own widget (in python), I need to get ...
13
votes
5
answers
3k
views
Gtk3 keys bindings in css files
Where can I find an exhaustive list of available keybindings that a user can define in a CSS file for GTK+ 3?
I have already checked those resources:
https://developer.gnome.org/gtk3/stable/...
13
votes
5
answers
29k
views
ModuleNotFoundError: No module named 'gi'
I am trying to run the following program:
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
Bu I am getting:
Traceback (most recent call last):
File "...
13
votes
2
answers
12k
views
Python and d-bus: How to set up main loop?
I have a problem with python and dbus. I checked out the developer docs and specifications, but I don't understand how to set up a main loop. I want to listen for notification events.
See
http://dbus....
13
votes
1
answer
1k
views
Serialize Gtk TreeStore / ListStore using JSON
I made a new example which shows much better what I am trying to do. The new example gives the following ouput. Is there a way that the data can go into the respective store key (the {} brackets)?
{
...
12
votes
2
answers
7k
views
Use glade with pygobject Gtk3
I am converting a script to use Gtk3 using the migration guide (Porting GTK2 to GTK3). I converted my import pygtk to a from gi.repository import Gtk and so on...
I'm stuck because the glade module ...
12
votes
5
answers
28k
views
How do I install PyGTK / PyGobject on Windows with Python 2.6?
I have an application which depends on PyGTK, PyGobject, and PyCairo that I built to work on Linux. I want to port it over to windows, but when I execute import gobject I get this:
Traceback (most ...
12
votes
2
answers
9k
views
Displaying PDF files with python3
I want to write a python3/PyGTK3 application that displays PDF files and I was not able to find a python package that allows me to do that.
There is pypoppler, but it looks outdated (?) and does not ...
12
votes
3
answers
4k
views
Displaying an image with Pygobject and Python 3 from in-memory data
I have some RGBA data in Python 3 and I want to display the image it represents in a GTK3 window without using any extra libraries.
First thing I tried was editing a Pixbuf's data as in an example (...
12
votes
1
answer
11k
views
installing PyGObject via pip in virtualenv [duplicate]
I'm actually upgrading an old django app from python2.7 to python3.4. While installing pygobject via pip, I got this error:
Collecting pygobject
Using cached pygobject-2.28.3.tar.bz2
Complete ...
12
votes
2
answers
8k
views
File msvc_recommended_pragmas.h missing while installing PyGObject via pip
I tried to install PyGObject via pip and it fails with given error:
Building wheels for collected packages: pygobject
Building wheel for pygobject (PEP 517) ... error
ERROR: Command errored out with ...
11
votes
4
answers
32k
views
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 ...
11
votes
2
answers
6k
views
Gtk.StatusIcon PopupMenu in python
im trying to port some small examples from PyGTK to the new PyGobject bindings, but ive hit a roadblock with a popupmenu, despite getting no errors, no menu is being shown on rightclick, here is the ...
11
votes
3
answers
6k
views
How to get the background color of a widget in GTK and Python?
I want to get the normal background color of a widget (a GtkHeaderBar, in this case). I'm currently using
style = self.get_titlebar().get_style_context()
to get the style, and
color = style....
10
votes
2
answers
13k
views
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....
10
votes
1
answer
6k
views
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 ...
10
votes
1
answer
3k
views
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.
10
votes
1
answer
8k
views
Right Click Menu (context menu) using PyGTK
So I'm still fairly new to Python, and have been learning for a couple months, but one thing I'm trying to figure out is say you have a basic window...
#!/usr/bin/env python
import sys, os
import ...
10
votes
3
answers
9k
views
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 ...
9
votes
1
answer
3k
views
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/...
9
votes
3
answers
881
views
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 ...
9
votes
2
answers
2k
views
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 ...
9
votes
1
answer
2k
views
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 = Gtk.Toolbar()
toolbar....
9
votes
1
answer
1k
views
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)
...
9
votes
3
answers
20k
views
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 ...
9
votes
2
answers
2k
views
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))
...
9
votes
1
answer
833
views
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....
8
votes
2
answers
4k
views
Gtk Switch activate signal not firing
I'm trying to use a Gtk.Switch widget in an app but "activate" signal is not firing by clicks.
It works fine when using the widget with keyboard by hitting reture/space key on it but clicks don't ...
8
votes
4
answers
2k
views
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....
8
votes
2
answers
6k
views
Gtk.CssProvider() how do ID based selectors work in Gtk3?
I've been fiddling with this on and off for a couple of days but just can't seem to come to grips with what the issues might be.
Essentially I'm trying to style some Gtk Widgets in Gtk3 using CSS ...
8
votes
2
answers
3k
views
gtk in-app notifications API referece
I've recently studied the gtk design patterns, and found the in-app notifications. There is an description on when to use it, but no reference to the gtk api.
I have searched for it, but found just ...
8
votes
1
answer
5k
views
How to create a complete menu using GIO Actions in PyGI GTK?
I'm trying to convert the menubar in my Gtk app so it will use GActions(from the Gio) as opposed of GtkActions in Python3 using GObject Instrospection.
I've been trying to figure it out on my own but ...
8
votes
3
answers
989
views
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....
8
votes
1
answer
2k
views
"Allocating size to..." GTK Warning when using Gtk.TreeView inside Gtk.ScrolledWindow
I'm receiving the following warnings in my GTK 3 application:
Gtk-WARNING **: Allocating size to __main__+MCVEWindow 0000000004e93b30 without calling gtk_widget_get_preferred_width/height(). How ...