pygobject

Get the window handle in PyGI

北慕城南 提交于 2019-12-19 11:28:42
问题 In my program I use PyGObject/PyGI and GStreamer to show a video in my GUI. The video is shown in a Gtk.DrawingArea and therefore I need to get it's window-handle in the realize -signal-handler. On Linux I get that handle using: drawing_area.get_property('window').get_xid() But how do I get the handle on Windows? I searched on the internet but found only examples for PyGtk using window.handle which does not work using PyGI. The GStreamer documentation provides an example which uses the GDK

Show icon or color in Gtk TreeView tree

吃可爱长大的小学妹 提交于 2019-12-19 09:44:29
问题 I am having difficulty loading a file or displaying a colour in one of the columns of a Gtk TreeView (Python binding of GTK3). An example taken from QGIS shows a icon in the first row and a blue circle in the second row. The colour is taken from the layer properties: My code looks like this but does not load the icon.png file in the same directory: #!/usr/bin/python3 from gi.repository import Gtk, Gdk, GdkPixbuf class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self) self

How do I change the property of a GTK widget such as a stack?

我的未来我决定 提交于 2019-12-19 09:15:15
问题 I've been taking a quick look at the GTK 3.10 documentation for a GtkStack. https://developer.gnome.org/gtk3/3.10/GtkStack.html It mentions that the child added to a GtkStack is given a property "icon-name". My question is - how can I change the value of this property. The reason - I want to change the GtkStackSwitcher button to be an icon not text but I want to code this - not use a GktBuilder UI. If you look at the gtk3-demo - Stack demo and the UI file you can see the GtkSwitcher has an

How to create a complete menu using GIO Actions in PyGI GTK?

╄→гoц情女王★ 提交于 2019-12-19 06:30:10
问题 I'm trying to convert the menubar in my Gtk app so it will use GActions (from the Gio) as opposed of GtkActions in Python3 using GObject Instrospection. I've been trying to figure it out on my own but so far it seems awfully complicated and I didn't have much luck with it. If someone could please post an example of how to create a simple menu GAction based with A submenu A menu item with a stock ID icon / hotkey A menu item with a non-stock icon / hotkey A checked menu item And radio menu

Bundling GTK3+ with py2exe

半世苍凉 提交于 2019-12-19 03:22:43
问题 Platform is Windows 7 64bit using python 2.7 and GTK3+ installed from http://sourceforge.net/projects/pygobjectwin32/files/?source=navbar The exe is compiled but fails to run, due to this The following modules appear to be missing ['gi.repository.Gdk', 'gi.repository.Gtk', 'overrides.registry'] How can i properly include these files? imports in my .py file from gi.repository import Gtk, Gdk my setup file #!/usr/bin/env python from distutils.core import setup import py2exe, sys sys.path.append

gi.repository Windows

落爺英雄遲暮 提交于 2019-12-17 18:47:23
问题 I'm developing an app which has to be 100% compatible on windows and on linux. On linux I have no problems, but on windows I came up with this message: from gi.repository import Gtk ImportError: No module named gi I installed pygobject, pygtkallinone, gtk.. what am I missing? 回答1: Most of Havok answer is correct, except that documentation has been improved a lot lately, with a Tutorial: http://python-gtk-3-tutorial.readthedocs.org/en/latest/ Including a PDF version for offline reading: http:/

How to Add Placeholder on TextView Object in PyGObject

好久不见. 提交于 2019-12-13 15:26:28
问题 I've added placeholder on Entry object: self._widget = Gtk.Entry() self._widget.set_placeholder_text("Enter your name") Now I want to add placeholder on TextView object, but I didn't find any method for it: self._widget = Gtk.TextView() 回答1: You should connect to focus-in-event and focus-out-event . If the text buffer is empty on focus-out-event , set a placeholder flag to true, add the placeholder text, and add a CSS class that you can optionally use to style the placeholder text gray. If

Cannot run python on windows. What am I missing?

心不动则不痛 提交于 2019-12-13 02:49:53
问题 I am pretty new to python. Please correct me if I show stupidity. So I am trying to run the following code: from gi.repository import Gtk class LisaMainWindow: def on_LisaMainWindow_destroy(self, object, data=None): print ("quit with cancel") Gtk.main_quit() def __init__(self): self.gladefile = "lisaMainWindow.glade" self.builder = Gtk.Builder() print ("gtk builder done") self.builder.add_from_file(self.gladefile) print ("glade loaded") self.builder.connect_signals(self) self.window = self

PyGobject VTE terminal, command printed twice

夙愿已清 提交于 2019-12-13 01:43:21
问题 I'm writing an application to connect to few Linux server via SSH, which using VTE terminal to make some operation on this server. To connect to this server I'm using bash expect command to provide password. I want to run this command instantly after VTE was run , but here I have some ugly behavior of VTE, command was printed twice to terminal, once before bash prompt, and second normal after bash prompt echo Here command to connesc ssh [drespondek@oc5045316303 ~]$ echo Here command to

How I can get DrawingArea window handle in Gtk3?

柔情痞子 提交于 2019-12-12 11:26:17
问题 I get this code on CEF Python 3 (link) ... self.container = gtk.DrawingArea() self.container.set_property('can-focus', True) self.container.connect('size-allocate', self.OnSize) self.container.show() ... windowID = self.container.get_window().handle windowInfo = cefpython.WindowInfo() windowInfo.SetAsChild(windowID) self.browser = cefpython.CreateBrowserSync(windowInfo, browserSettings={}, navigateUrl=GetApplicationPath('example.html')) ... This code [ self.container.get_window().handle ] don