pygtk

How to Set Call Back For Enter key of GtkTextView?

how can I set call back on enter key of GtkTextView Widget and set TextView to work like gtk.entry (single-line)? ...

How to properly store object reference in treemodel?

I'm trying to store an object reference in the rows of a treemodel so that I can access and modify the data in the underlying data structure. What would be the proper way to do this? The only way I've found so far to accomplish this is to inherit my data structure nodes from gobject, and then store a gobject column in each row. Is there ...

Saving in pygtk

Im writing an app using pygtk and i was wondering how would my app be able to save data on the users computer. I plan go distribute this across windows and unix. What would be the best way to go about this? ...

What is a 'good practice' way to write a Python GTK+ application?

I'm currently writing a PyGTK application and I'd like some advice as to the best way to structure my application. Basically the application will read a specific file specification and present it in a GUI for editing. Currently I have a parser.py which handles all the low level file IO and parsing of the file. I'm displaying the content...

How do I include an image in a window with pygtk?

Hello there. I'm trying to make a program in python which creates a fullscreen window and includes an image, but I don't really know how to do that. I've tried to read documentations on pygtk and I've searched in both goodle and stackoverflow, without any success. Here's my current code. def __init__(self): pixbuf = gtk.gdk.pixbuf_n...

VLC Python binding and event manager

Hi everyone, I'm using libVLC with python's bindings to embeded streams in a GTK Socket; I've got a class Player for VLC: class Player(gtk.Socket): def __init__(self, id): gtk.Socket.__init__(self) def loadfile(self, filename, wid): filename=filename.replace("\"","") p=vlc.MediaPlayer(filename.strip()) ...

Set position of image in a window using pygtk.

Hello! Is it possible to set the position of an image using pygtk? import pygtk import gtk class Example: self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.image = gtk.Image() self.image.set_from_file("example.png") # Position goes here (it should, shouldn't it?) self.window.add(self.image) self.image.show() ...

How to correct drive names in Gtk.FileChooserDIalog under Windows?

Hello! I write the simple example with gtk.FileChooserDialog. It works fine, but there is one problem under WIndows: I see '\' in first button instead of real drive names, such as 'C:\', 'D:\' and so on. I explored FileChooserDialog structure and tried to change '\' by real drive name, but it works unstable. Can anybody help me? import ...

Recommended .gitignore file for Python projects?

I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a good .gitignore for Visual Studio projects, but I don't see many recommendations for Python and related tools (PyGTK, Django). So far, I have... *.pyc *.pyo ...for the compiled ...

gtk get new selection in a treeview during the signal

I want to detect whenever the selection of my gtk.TreeView changes and, when it does, to call a function w/ this information. The only way I've found to do it so far is to attach to all these signals: ... self.sitterView.connect("cursor-changed", self.selectionChanged) self.sitterView.connect("unselect-all", self.selectionChange...

Get original row number from .get_model() and .get_path() after TreeView was resorted

So I have this TreeView/TreeStore, which I fill with data from a list. My application uses only said list as reference data. The TreeStore is just constructed for display. And the TreeView can be resorted by tipping the column headers. Because .set_sort_column_id() was used for initialization of each column. Problem is, following code a...

How to import function handlers from other file to a Python/GTK Builder program?

I have a Python script which uses a glade file to define its UI, and has a lot of repetitive widgets, each one to adjust a different numerical attribute of a certain active object. Since it is repetitive, I decided to define all the handlers in a separate file for encapsulation and readability. Here are some code excerpts: The main file...

gtk: nicer way to make cellrenderercombo finish editing as soon as an entry is selected

I have a TreeView with a CellRendererCombo in it. Currently, I've connected the editing signal to a function which changes the underlying model and does some other actions based on the new value. However, this is annoying for the user. Dropping down the list and clicking on a new item does not seem to cause editing to "finish". Instead t...

Override theme settings of gnome-settings-daemon in GTK

In a pygtk app, I'm using rc_parse_string to adjust the appearance of my GUI. (Mostly to make it look more native under Windows, and to theme individual widgets.) This, for example, would change the icon theme for my application: gtk.rc_parse_string(""" gtk-icon-theme-name = "Galaxy" """) This works under Windows, but ...

Simple ListBox w/ PyGTK Issues

Environment: PyGTK Glade Problem: After following several tutorials detailing how to get a ListBox up and running using the GtkTreeView widget alongside a gtk.ListStore object I still can't seem to get my data from the ListStore to show up in the GtkTreeView. Request: Anyone have a link to a thorough tutorial I can follow or willin...

pygtk: What class should my custom widgets inherit from?

When making a custom widget in pygtk, what class should it inherit from? I want to be able to put the widget inside other widgets, but I don't want other people to put stuff in mine. Usually I make my widgets inherit from gtk.HBox or gtk.VBox, and that works fine, but it is possible then for someone to do a pack_start() on my widget and ...

Why is the notebook control not showing up in my window?

Although I am not new to Python, this is my first attempt at using Glade to design the interface. My Python file looks like this: import gobject import gtk import gtk.glade class prefs_dialog: def __init__ (self): # Initialize the dialog self.window = gtk.glade.XML("file.glade").get_widget("prefs_dialog") ...

python glade: window doesn't appear

I initially had a GladeXML object error. But I solved it after reading this post --> http://stackoverflow.com/questions/2668618/python-glade-could-not-create-gladexml-object I've tried both the solutions mentioned there. However the window still doesn't appear. ...

Nautilus python

I'm developing a nautilus extension and I have the following code: #!/usr/local/bin/python # -*- coding: utf-8 -*- import urllib import gtk import pygtk import nautilus import gconf import gtk.glade class Slide (nautilus.MenuProvider): f = None def __init__(self): self.client = gconf.client_get_default() self....

Is there a library or reference around showing how to build a Ribbon menu using PyGTK?

Hey there, everyone. A really random question, but I'm looking to get into some GUI programming with Python, specifically with the PyGTK library. I've only ever done GUI programming with Java/Swing, and I'd like to do some independent, personal projects in Python as a way of learning my way around the language, since it's been something ...