Take the following demo code (from the GIO answer to this question), which uses a GIO FileMonitor to monitor a directory for changes:
import gio
def directory_changed(monitor, file1, file2, evt_type):
print "Changed:", file1, file2, evt_type
gfile = gio.File(".")
monitor = gfile.monitor_directory(gio.FILE_MONITOR_NONE, None)
monit...
Hello people,
consider the following python code:
import gtk
class MainWindow():
def __init__(self):
self.window = gtk.Window()
self.window.show()
if __name__ == "__main__":
main = MainWindow()
gtk.main()
I'd need to catch clicks anywhere inside this gtk.Window().
I haven't found any suitable event (I als...
As the title suggests, I have a pygtk.TreeView whose model is sorted and filtered. According to the documentation: "Drag and drop reordering of rows only works with unsorted stores.". The only other information given relates to using external sources, which in this case I don't need.
I tried implementing it anyway, providing handlers to...
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 "...
I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background.
The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4C4C4"), but no col...
hi, i am having a issue with treeview liststore trying to get a real-time update, and I created a example to simulate what I'd like to do.
I want liststore1 updated each loop.
http://img204.imageshack.us/i/capturadetela5.png/
it should update the treeview column 'speed' and give to it a different number every second,
something like a d...
The code below creates a column of three labels. I would like to take the middle label, and replace it with another widget using the text from the label after the initial creation of the UI.
My actual use case is to take a GTKBuilder populated UI, and replace any particular named label with a dynamically wrapped label at run time. (I us...
http://img824.imageshack.us/i/capturadetelag.png/
how update a gtk.liststore?
i mean get a random number every second on a column just like example,
such as a download manager list, i'd like to have a simple example to know how this Liststore
works for update the list, because i can't find a effective way to do something like a:
stor...
In a gtk.IconView I can use get_selected_items() to find the paths of the items a user selected in the view.
I'm now looking for the corresponding method to set the selection of an IconView. But I can't find any!? What am I missing?
...
Hello, I am having a problem with widget Gtk.Table - I would like to know, if there is a way how to get a current size of the table (number of rows and columns).
Thank you, very much for help, Tomas
...
Hi, I have a simple GUI build with Glade 3 and I have a gtk.Entry widget with name "input_entry1". I would like to instantiate new gtk.Entry widget called "input_entry2" but I would like to do it simply in Python code, not with Glade, but I can't figure out how to set a name to instance of widget (or create a named widget).
Thanks a lot...
I'm trying to capture the configure-event for every window to create a windows 7-esque snap feature. I know there are solutions involving compiz-fusion, but my installation is running within vmware and doesn't have hardware acceleration to run compiz. I figured a simple python script could do what I wanted, but I can't seem to find the r...
Started my first Python pet project using PyGTK. Though it is a really powerful GUI toolkit and looks excellent, I have some pet peeves. So I thought about transitioning to something else, as it's not yet too extensive. Had a look around on SO and python documentation, but didn't get a good overview.
What's nice about PyGTK:
Glade fil...
This tutorial on using GObject in Python only covers using a property of type gobject.TYPE_FLOAT.
I've adapted it to use an enumerated type:
import pygtk
pygtk.require('2.0')
import gobject
FUEL_NONE = 0
FUEL_SOME = 1
FUEL_FULL = 2
class Car(gobject.GObject):
__gproperties__ = {
'fuel' : (gobject.TYPE_ENUM, ...
Dear all,
I'working on this nice example that shows a webcam output in a GTK widget with python and GStreamer:
http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html
here is the code:
#!/usr/bin/env python
import sys, os
import pygtk, gtk, gobject
import pygst
pygst.require("0.10")
import gst
class GTK_Main:
def __init__(sel...
I mean like a frame with some widgets which overlap the background (the image), basically how do you partially overlap/clobber an Image?
Like a background in a Firefox theme, for instance.
...
Hi,
I have written this short script (which I've stripped away some minor detail for size) and I'm getting a very simple error, yet, I don't understand why! I'm very new to Python, so maybe someone can explain the issue and why it's not working?
The error seems to fall when I wish to print the full custom serial write string back to t...
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, .....)
bu...
I'm trying to make my pygtk application behave the way openoffice calc does, regarding the decimal point. This means that when receiving a KP_Decimal key (the dot in the keypad) I want my entries to show whatever the decimal point is in the current locale (dot or comma, appropriately).
I've searched for a long while now, and I haven't ...
Using GTK+'s GtkFileChooserDialog, how can I allow the user to select a file or a folder (both are valid here). The actions available are mutually exclusive.
...