pygobject

Load GUI from a Glade with GtkSourceView in PyGObject

匆匆过客 提交于 2019-12-04 03:54:30
I'm trying to use a Glade file that has a GtkSourceView widget in PyGObject. I've wrote a little guide on how to start using the new GtkSourceView 3.0 in Glade: http://cjenkins.wordpress.com/2012/05/08/use-gtksourceview-widget-in-glade/ The problem is when I want to load that Glade from PyGObject: from gi.repository import Gtk, GtkSource from os.path import abspath, dirname, join WHERE_AM_I = abspath(dirname(__file__)) class MyApp(object): def __init__(self): self.builder = Gtk.Builder() self.glade_file = join(WHERE_AM_I, 'test.glade') self.builder.add_from_file(self.glade_file) if __name__ ==

How to send commands to pygobject virtual terminal?

泪湿孤枕 提交于 2019-12-04 02:36:51
问题 Right now I can make a terminal but the output is not used as a command. It just prints a string to the virtual terminal. from gi.repository import Gtk, GObject, Vte class TheWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="inherited cell renderer") self.set_default_size(400, 200) box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) v = Vte.Terminal() #v.connect ("child-exited", lambda term: gtk.main_quit()) length = len("echo \"string\"\n") v.feed("echo \"string\"\n"

installing PyGObject via pip in virtualenv [duplicate]

我的梦境 提交于 2019-12-04 01:44:54
This question already has answers here : Closed 2 years ago . Python cannot install PyGObject (3 answers) I'm actually upgrading an old django app from python2.7 to python3.4. While installing pygobject via pip, I got this error: Collecting pygobject Using cached pygobject-2.28.3.tar.bz2 Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 20, in <module> File "/tmp/pip-build-9dp0wn96/pygobject/setup.py", line 272 raise SystemExit, 'ERROR: Nothing to do, gio could not be found and is essential.' ^ SyntaxError: invalid syntax ----------

Package PyGObject Python 3 program with pynsist?

☆樱花仙子☆ 提交于 2019-12-03 20:12:24
I would like to package a Python3-PyGObject program with pynsist. The repository has an example for PyGTK and it made me think that it shouldn't be too hard to change the example. The example can be found here: https://github.com/takluyver/pynsist/tree/master/examples/pygtk In this file ( https://github.com/takluyver/pynsist/blob/master/examples/pygtk/grab_files.sh ) I think one just has to grab the files targeting GTK 3 ( http://www.gtk.org/download/win32.php ): wget -O gtkbundle.zip http://win32builder.gnome.org/gtk+-bundle_3.6.4-20130921_win32.zip wget -O pygobject.exe http://sourceforge

Use glade with pygobject Gtk3

ⅰ亾dé卋堺 提交于 2019-12-03 16:32:40
问题 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() ... 回答1: Well, the solution is pretty obvious, after calling to Gtk.Builder() one needs to convert the old glade interface with the gtk

A sorted and filtered treemodel in Python Gtk+3..?

痞子三分冷 提交于 2019-12-03 14:34:10
I am trying to get a treemodel (a liststore in fact) that can be filtered and also sorted. I have the following piece of code self.modelfilter = self.liststore.filter_new() self.modelfilter.set_visible_func(\ self._visible_filter_function) self.treeview.set_model(self.modelfilter) where self.liststore and self.treeview are standard Gtk.ListStore and Gtk.TreeView objects that I get from a glade file, and self._visible_filter_function is a filtering function. The problem is that self.modelfilter does not seem to be sortable. When I click on the column headers (of the columns in self.treeview )

GTK+ 3.0: How to use a Gtk.TreeStore with custom model items?

♀尐吖头ヾ 提交于 2019-12-03 13:34:22
问题 I'm trying to develop a GTK application in Python and I'm really stuck with the correct usage of a gtk.TreeStore. My main problem: I've already parsed some JSON and I have my own data structure which ist basically a Python list and two kinds of objects: One represents a collection of items (collections can't be nested) and one for representing items (which might appear in the list as well as in a collection). I'm already familiar with the basic usage of a TreeStore and managed to get items

Right Click Menu (context menu) using PyGTK

自作多情 提交于 2019-12-03 12:48:28
So I'm still fairly new to Python, and have been learning for a couple months, but one thing I'm trying to figure out is say you have a basic window... #!/usr/bin/env python import sys, os import pygtk, gtk, gobject class app: def __init__(self): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("TestApp") window.set_default_size(320, 240) window.connect("destroy", gtk.main_quit) window.show_all() app() gtk.main() I wanna right click inside this window, and have a menu pop up like alert, copy, exit, whatever I feel like putting down. How would I accomplish that? There is a example for

Displaying PDF files with python3

老子叫甜甜 提交于 2019-12-03 09:34:52
问题 I want to write a python3/PyGTK3 application that displays PDF files and I was not able to find a python package that allows me to do that. There is pypoppler, but it looks outdated (?) and does not seem to support python3 (?) Do you have any suggestions? EDIT: Note, that I don't need fancy features, like pdf forms, manipulation or writing. 回答1: It turns out, that newer versions of poppler-glib don't require bindings as such. They ship with GObject Introspection files and can therefore be

Can't import Webkit from gi.repository

*爱你&永不变心* 提交于 2019-12-03 09:04:53
问题 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? 回答1: 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