pygobject

PyGObject for Python 3.5.1?

♀尐吖头ヾ 提交于 2019-12-12 10:16:02
问题 I am using Debian Linux, and I have the package python3-gi installed from Synaptic, and this works fine if I use my Python 3.4 interpreter. But, when I run a Gtk+3 program using 3.5, it gets stuck at the from gi.repository import Gtk line, saying there's no module named Gtk. Additionally, I don't think that pip works for Python 3.5 on my computer, although I'm not sure. I just know that pip install PyGObject doesn't work. Finally, when I try to use Pycharm's specific package installer

Load GUI from a Glade with GtkSourceView in PyGObject

隐身守侯 提交于 2019-12-12 08:37:31
问题 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

installing PyGObject via pip in virtualenv [duplicate]

浪子不回头ぞ 提交于 2019-12-12 08:24:11
问题 This question already has answers here : Python cannot install PyGObject (3 answers) Closed 2 years ago . 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,

WebKit2.JavascriptResult.get_value() throws exception “TypeError: Couldn't find foreign struct converter for 'JavaScriptCore.Value'”.

跟風遠走 提交于 2019-12-11 13:52:47
问题 I am writing a python3 + webkit2 + gtk3 based GUI. Everything works fine, but when I tried to use WebKit2.WebView.run_javascript_finish() in a callback function, getting the return (a WebKit2.JavascriptResult objetc), e extrat the value with WebKit2.JavascriptResult.get_value(), I received a "TypeError: Couldn't find foreign struct converter for 'JavaScriptCore.Value'". I have a "from gi.repository import JavaScriptCore" on the imports, and I dont know why this error is occuring. ps: Sorry

How to disable web security (cross origin reequest) in webkit gtk

三世轮回 提交于 2019-12-11 07:54:52
问题 I'm trying to write a site specific browser for a few sites and am facing an issue with webkitgtk. WebKitGtk blocks some cross domain request as a security measure and there is no way to disable it in the WebKitGtk API Python simple example from gi.repository import Gtk, WebKit window = Gtk.Window() webview = WebKit.WebView() webview.load_uri('http://drive.google.com') window.add(webview) window.show_all() Gtk.main() Output: ** Message: console message: @0: Unable to post message to https://0

Gtk.Entry in Gtk.TreeView (CellRenderer)

江枫思渺然 提交于 2019-12-11 07:31:40
问题 I want to pack a Gtk.Entry (with Gtk.EntryCompletion hooked up) into a cell in a Gtk.TreeView . Does anyone know how this can be done? (I just need entry completion on a text entry in a tabular view.) Do I perhaps need to subclass Gtk.CellRenderer or Gtk.CellRendererText , and override the start_editing method (or similar)? I can find examples of subclassing Gtk.CellRenderer , but not modifying the editable behaviour. I can't find the source-code for the Gtk.CellRendererText class, either. I

how to set background color GtkBox in Gtk+3?

二次信任 提交于 2019-12-11 05:20:02
问题 I create application in GTK+3 and I Would like to change the background color for GtkBox but can not here this code: box.modify_bg(Gtk.StateType.NORMAL, color); 回答1: In "Common Questions" of GTK+3 is the answer to your question. In the basic form, you can use: box.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(.5,.5,.5,.5)) In this case, the color will be a soft grey, half transparent. Probably, you want to paint it during the draw signal. 来源: https://stackoverflow.com/questions

Set window gravity in PyGObject?

北战南征 提交于 2019-12-11 05:05:43
问题 Every time I try to set the gravity of my application, it keeps throwing an error message like this: AttributeError: 'gi.repository.Gdk' object has no attribute 'GRAVITY_SOUTH_EAST' What is the correct method for setting the gravity of a GTK3 application with python? (Not pygtk, I'm using the newer PyGI libraries.) There isn't a documentation for PyGI AFAIK, and when I do help(Gdk.Gravity) in the python console it returns GDK_GRAVITY_SOUTH_EAST as an option. 来源: https://stackoverflow.com

Some questions about switches in python

拟墨画扇 提交于 2019-12-10 19:16:47
问题 This is my first Question here at StackOverflow, so please be patient with me if some info isn't present or I missed something important, but anyways i'll do my best :) Recently I started to code in Python2.7, so I'm not very good at it. While playing with PyGtk, PyGObject, Glade, etc I found something particular about switches (Haven't tried with any other widget, so I don't know if it happens somewhere else. Most likely it doesn't, I hope...) I made a very basic GUI with a single "window"

How to unset a timer set by python gobject.timeout_add ? threads?

六月ゝ 毕业季﹏ 提交于 2019-12-10 16:17:01
问题 I want to set timer in a thread and kill that thread when I want to unset the timer set by gobject.timeout_add, is this a good way to do this? basically I want to run a function for every 180 seconds but I want to be able to stop it whenever I want to(called from another function). How to achieve this properly? I have read that killing a thread is bad! How bad is it for simple tasks like this? 回答1: According to the docs when you call gobject.timeout_add it returns a int which is unique for