pygtk

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

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

gtk drawing set background image

霸气de小男生 提交于 2019-12-02 18:56:13
问题 I have a drawing area, and an 'png' image I want to load that image to my drawing area as background. the screen is bigger then my image and the problem is it does not 'tile' my image I have tried adding image as pixbuf and pixmap but it doesnot help i use this line gc.set_tile(pixmap) area.window.draw_drawable(gc, pimap, .....) but it does not help 回答1: i found the answer i put the code here for others area=gtk.Drawingarea() pixbuf=gtk.gdk.pixbuf_new_from_file('background.png') pixmap, mask

Is there a gi.repository documentation for python?

狂风中的少年 提交于 2019-12-02 18:49:24
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 similar for Python? (I'm not looking for dir(Gtk) or help(Gtk) in the Python console.) I think you're looking for this . It's a work in progress, but basically is a tutorial for Gtk3 in python. I doesn't really cover any other thing aside from Gtk widgets (so no Glib, for example), but it's still useful to get started.

urllib2 opener hangs if run inside a thread

╄→гoц情女王★ 提交于 2019-12-02 16:29:57
问题 I have a code that is running fine (connect to a page , get PHPSESSID) . when i put that code in a function , then made a thread of it : Gdk.threads_enter() threading.Thread(target=self.do_login,args=()).start() Gdk.threads_leave() the code hangs on f = opener.open(req) any ideas why ? when i force close the application , it completes everything and prints everything in the terminal without errors . why does it hang on that particular line in thread only . it does not outside of a thread .

urllib2 opener hangs if run inside a thread

爱⌒轻易说出口 提交于 2019-12-02 08:39:43
I have a code that is running fine (connect to a page , get PHPSESSID) . when i put that code in a function , then made a thread of it : Gdk.threads_enter() threading.Thread(target=self.do_login,args=()).start() Gdk.threads_leave() the code hangs on f = opener.open(req) any ideas why ? when i force close the application , it completes everything and prints everything in the terminal without errors . why does it hang on that particular line in thread only . it does not outside of a thread . Okay, I just repost the comment here so that the question can get solved. As has been mentioned on other

How do I iterate through all Gtk children in PyGtk recursively?

纵然是瞬间 提交于 2019-12-02 07:30:36
问题 I would like to get a recursive list of all Gtk children object of the main window with pygtk . How do I do that? 回答1: Noting these: Python GTK+ widget name Python recursion and return statements ... here is a function, which is a port of a PHP one from Getting a descendant (child) widget by name | PHP-GTK Community: # http://cdn.php-gtk.eu/cdn/farfuture/riUt0TzlozMVQuwGBNNJsaPujRQ4uIYXc8SWdgbgiYY/mtime:1368022411/sites/php-gtk.eu/files/gtk-php-get-child-widget-by-name.php__0.txt # note get

alpha blending in gtk

给你一囗甜甜゛ 提交于 2019-12-02 02:26:07
问题 How can you draw semi-transparent primitives such as filled polygons to a Drawable in GTK? Its 2010, and I google isn't finding how to put an alpha value into a colour for me. What am I missing? 回答1: Use gtk.gdk.Drawable.cairo_create() and operate on the returned gtk.gdk.CairoContext . See documentation. Cairo is a generic vector 2D library that is used in GTK+ since many versions ago; GDK drawing primitives are deprecated in its favor (though not the whole GDK). 回答2: Here is actual source

alpha blending in gtk

馋奶兔 提交于 2019-12-02 01:04:17
How can you draw semi-transparent primitives such as filled polygons to a Drawable in GTK? Its 2010, and I google isn't finding how to put an alpha value into a colour for me. What am I missing? Use gtk.gdk.Drawable.cairo_create() and operate on the returned gtk.gdk.CairoContext . See documentation . Cairo is a generic vector 2D library that is used in GTK+ since many versions ago; GDK drawing primitives are deprecated in its favor (though not the whole GDK). Here is actual source code to do it. I just wanted to gray out the entire pixbuf, but to do a shape you'd just have to use the

update a gtk.VBox dynamically

自作多情 提交于 2019-12-02 00:35:49
问题 I have been using this website pretty often in order to solve small issues that I have while programming in Python. This time, somehow I could not find a suitable solution for my situation. So, here is my problem: I want to dynamically add entries to a gtk.VBox widget. The problem is that it doesn't work the way I want it to work. I simply have a button, whose action is to add an additional widget to a VBox. Unfortunately the widget doesn't appear on the window. I guess, I have to add