pygobject

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

岁酱吖の 提交于 2019-12-03 08:08:48
问题 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 the PyGTK branch. Due to all the minor differences between these implementations, I often overlook things and cause breakage that I miss and accidentally release, only to be caught by the users. I'm trying to figure out a good way to design

Use glade with pygobject Gtk3

风流意气都作罢 提交于 2019-12-03 05:49:13
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 was loaded from module gtk: import gtk import gtk.glade but there's no way now to do that anymore. Note that I would only need a replacement for gtk.glade.XML() ... Well, the solution is pretty obvious, after calling to Gtk.Builder() one needs to convert the old glade interface with the gtk-builder-convert command to get the interface file in the right version. $ gtk-builder-convert myui.glade

PyGObject GTK+ 3 - Documentation?

怎甘沉沦 提交于 2019-12-03 02:01:56
问题 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 constructor. It seems I can't do much reflection in Python because everything in PyGObject is dynamically generated. All I want is to know what arguments I can pass to this constructor! There doesn't appear to be an equivalent of this object in the GTK+ 3 documentation, and reading the source

Can't import Webkit from gi.repository

百般思念 提交于 2019-12-02 23:08:38
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 "<stdin>", line 1, in <module> ImportError: cannot import name Webkit What am I doing wrong? Your error seems a typo and the library is not found for that. You have to put "WebKit" instead of "Webkit". Additionaly if you use Ubuntu check the library existence with: $ locate girepository | grep WebKit /usr/lib/girepository-1.0/WebKit-3.0.typelib If doesn't exist you need install the package gir1.2

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

不想你离开。 提交于 2019-12-02 21:44:15
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 the PyGTK branch. Due to all the minor differences between these implementations, I often overlook things and cause breakage that I miss and accidentally release, only to be caught by the users. I'm trying to figure out a good way to design some unittests that would, preferably, be suitable to run on both code bases. It's not an overly

PyGObject GTK+ 3 - Documentation?

蹲街弑〆低调 提交于 2019-12-02 15:38:47
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 constructor. It seems I can't do much reflection in Python because everything in PyGObject is dynamically generated. All I want is to know what arguments I can pass to this constructor! There doesn't appear to be an equivalent of this object in the GTK+ 3 documentation, and reading the source code to figure out the bindings has proven to be an extremely daunting task. Any ideas?? I agree that this

import errors with Python and Gtk+ 3

烈酒焚心 提交于 2019-12-02 06:27:47
问题 I'm working in a program that is written in Gtk+ 3 and Python . A related question I asked about my program is here. Now, that I advanced a bit more, I have the following imports: import aplpy import montage import subprocess from gi.repository import Gtk, GdkPixbuf and when I run it I get this error: $ ./makeRGB-frame.py Traceback (most recent call last): File "./makeRGB-frame.py", line 34, in <module> from gi.repository import Gtk, GdkPixbuf File "/usr/lib64/python2.7/site-packages/gi/_

PyGObject and glade send window to the front

妖精的绣舞 提交于 2019-12-02 05:40:56
im having some problems to send to the front a GTK window. I have a main window ( window_root ) with a button that launches another window ( window_programs ). with this commands: window_root.hide() window_programs.show() then, in window_programs , i have a button that displays another window ( window_list ) with the command: window_list.show() window_list is modal. The problem was that window_list appeared at the back of window_programs . so i did some research and i found window_list.show() . The problems is that window_list appears at the front, but when i click it window_programs comes to

How to correctly covert 3d array into continguous rgb bytes

时光毁灭记忆、已成空白 提交于 2019-12-01 21:40:29
问题 I'm trying to convert the 3d array returned by cv2.imread to the continguous rgb byte array , in order to display in GTK. And below is my conversion code: def ndarr2rgb(img): r_arr = img[:, :, 0].ravel() # read channel g_arr = img[:, :, 1].ravel() # green channel b_arr = img[:, :, 2].ravel() # blue channel numItems = img.shape[0] * img.shape[1] * img.shape[2] # number of entries in byte array z = img.shape[2] # z dimension, always equal to 3 arr = np.zeros((numItems, 1)) # to fill the byte

Gtk 3 position attribute on insert-text signal from Gtk.Entry is always 0

℡╲_俬逩灬. 提交于 2019-12-01 18:19:40
问题 I am having trouble in managing the insert-text signal emitted by the Gtk.Entry widget. Consider the following example: from gi.repository import Gtk def on_insert_text(entry, new_text, new_text_length, position): print(position) entry = Gtk.Entry() entry.connect('insert-text', on_insert_text) window = Gtk.Window() window.connect("destroy", lambda q: Gtk.main_quit()) window.add(entry) window.show_all() Gtk.main() The position attribute I am receiving on the signal handler is always 0. Unless