pygtk

How to search through a gtk.ListStore in pyGTK and remove elements?

限于喜欢 提交于 2019-12-31 02:29:09
问题 I have the following code (where store is a gtk.ListStore and titer is a gtk.TreeIter . The docs say that if there is no next row, iter_next() will return None , hence the break when that is found. It is supposed to search through the ListStore of (int, str) and remove the one item whose int component matches item_id. while True: if store.get_path(titer)[0] == item_id: store.remove(titer) break else: titer = store.iter_next(titer) if titer is None: break However, if an element in the middle

How do you change alternating background row colors of a gtk.TreeView in pygtk?

笑着哭i 提交于 2019-12-30 20:00:53
问题 I'm trying to change the alternating background color of a treeview. I know that this should normally be left up to the theme, but I'd like to override to test the gtk Style functionality. According to the treeview documentation here, I learned that the TreeView has several style options that are Read-only, including "even-row-color", "odd-row-color" and "allow-rules"(which according to the documentation, allows drawing of even and odd row colors). And I know that in order to override those

import gtk/glib produces ImportError: DLL load failed

☆樱花仙子☆ 提交于 2019-12-30 08:41:15
问题 I installed the latest versions of python (2.6.5), gtk+, pygtk (and friends) from their respective websites on Windows XP SP3. When you try to import gtk (or just glib for that matter), an ImportError is raised: Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python26\lib\site-packages\gtk-2

ImportError: No module named _backend_gdk

匆匆过客 提交于 2019-12-29 05:21:12
问题 I am starting to get some insight into interactive plotting with python and matplotlib using pyGTK+. Therefore I took a look at the example given at the matplotlib website. This is a short exerpt of the Code: #!/usr/bin/env python """ Example of embedding matplotlib in an application and interacting with a treeview to store data. Double click on an entry to update plot data """ import pygtk pygtk.require('2.0') import gtk from gtk import gdk import matplotlib matplotlib.use('GTKAgg') # or

How to display an image from web?

若如初见. 提交于 2019-12-29 04:54:06
问题 I have written this simple script in python: import gtk window = gtk.Window() window.set_size_request(800, 700) window.show() gtk.main() now I want to load in this window an image from web ( and not from my PC ) like this: http://www.dailygalaxy.com/photos/uncategorized/2007/05/05/planet_x.jpg How can I do that ? P.S. I don't want download the image ! I just want load the image from the URL. 回答1: This downloads the image from a url, but writes the data into a gtk.gdk.Pixbuf instead of to a

Running function 5 seconds after pygtk widget is shown

ε祈祈猫儿з 提交于 2019-12-29 04:19:49
问题 How to run function 5 seconds after pygtk widget is shown? 回答1: You can use glib.timeout_add(interval, callback, ...) to periodically call a function. If the function returns True then it will be called again after the interval; if the function return False then it will not be called again. Here is a short example of adding a timeout after a widget's show event: import pygtk pygtk.require('2.0') import gtk import glib def timer_cb(): print "5 seconds elapsed." return False def show_cb(widget,

Serious instability with pygtk 2.22 and python 2.6

我们两清 提交于 2019-12-25 16:54:36
问题 Has anybody come across this? I've taken the GTK HelloWorld sample. It runs fine. However, if i import win32ui , then it does not shutdown properly (as explained in this question ). There are other problems. In the process of narrowing down my application to see what caused it to not shutdown, I came upon a point where I was deconstructing a logger class I had written that I had no problems with. In the constructor I had the line: self.logger = logger I had commented out the rest of the class

Disable right click in GTK window

混江龙づ霸主 提交于 2019-12-25 12:10:38
问题 I would disable right click (and so context menu) in a Python GTK window (pyGTK) where inside is located a "window" pyWebKitGtk. Someone can help me writing some lines of code? I think that would better delete event directly in pyGTK but if you know how don't show context menu in pyWebKitGtk is good anyway. TNK TNK TNK Realy cutted code: import gtk import webkit window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect("destroy", gtk.main_quit) browser = webkit.WebView() browser.open("http:/

Determining path to current wallpaper with pygtk (maybe X11?)

余生颓废 提交于 2019-12-25 05:33:10
问题 I would like to determine a user's wallpaper path with PyGTK. If possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used. 回答1: You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an

Determining path to current wallpaper with pygtk (maybe X11?)

一个人想着一个人 提交于 2019-12-25 05:33:02
问题 I would like to determine a user's wallpaper path with PyGTK. If possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used. 回答1: You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an