pygtk

CSS styling for Gtk Widgets not working (Python, Gtk4?

CSS styling for Gtk Widgets not working (Python, Gtk4)? Question: In my app I want some kind of profile picture a user can have. At first wanted to use libadwaita’s Avatar widget, but it cannot load images from a file, which is a feature that I need. So I thought I would just implement a …

Total answers: 1

Python 3 + GTK 4 – Buttons with pictures and labels look weird

Python 3 + GTK 4 – Buttons with pictures and labels look weird Question: I develop a simple app for Linux, Kamarada Firstboot (source on GitLab), using Python 3 and GTK, and I’m migrating from GTK 3 to GTK 4. In case you are curious, you can see it in action if you download the …

Total answers: 1

GtkAboutDialog not working when press two times

GtkAboutDialog not working when press two times Question: I am starting GtkAboutDialog from a menubar item. This is the function toggling the dialog: def open_about(self, *args): x = about.run() if x == -4: # When pressing close; about.destroy() If I click the menubar about item once, there is no problem, dialog opens and I can …

Total answers: 1

Drop file in Python GUI (GTK)

Drop file in Python GUI (GTK) Question: I would like to write a little app who takes a selected number of file, and store the path of everything for future things. Basically: Select mixed (images, audio, video) file from Nautilus (in this case), drag them, drop them in this GUI and get the absolute path …

Total answers: 3

How to install poppler in ubuntu 15.04?

How to install poppler in ubuntu 15.04? Question: Poppler is a PDF rendering library based on the xpdf-3.0 code base. I have already downloaded the tar.xz file from the official site http://poppler.freedesktop.org/ But I do not know what to do with this file Is there any command to install or run? P.S. – I am …

Total answers: 4

Installing PyGtk in virtualenv

Installing PyGtk in virtualenv Question: So I am trying to run a simple matplotlib example in my virtualenv (in the console). Here’s the code: import matplotlib matplotlib.use(‘GTKAgg’) import matplotlib.pyplot as plt radius = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] area = [3.14159, 12.56636, 28.27431, 50.26544, 78.53975, 113.09724] plt.plot(radius, area) plt.show() However, when I run this …

Total answers: 5

Is there a gi.repository documentation for python?

Is there a gi.repository documentation for python? Question: I’m looking for a gi.repository module documentation and I can’t find anything on the internet. All I found is documentation of new Gtk3 libraries for C, or old PyGtk 2.0 Reference Manual I’m looking for something like PyGtk 2.0 Reference Manual but for Gtk3. Is there something …

Total answers: 5

Periodically call a function in pygtk's main loop

Periodically call a function in pygtk's main loop Question: What’s the pygtk equivalent for after method in tkinter? I want to periodically call a function in the main loop. What is the better way to achieve it? Asked By: houqp || Source Answers: Use gobject.timeout_add: import gobject gobject.timeout_add(milliseconds, callback) For example here is a progress …

Total answers: 3

What's the recommended way to unittest Python GUI applications?

What's the recommended way to unittest Python GUI applications? Question: 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 on the PyGObject branch and then I port changes over to …

Total answers: 4

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

Mysterious GObject warning: assertion `G_IS_OBJECT (object)' failed Question: 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 warning: /usr/lib/python2.7/site-packages/gi/types.py:44: Warning: g_object_set_qdata: …

Total answers: 3