草庐IT

PyGObject

全部标签

windows - 导入 Gtk 和 win32ui 模块时,Python.exe 在关闭 Gtk.main() 后继续运行

我在Windows7上运行python2.7.13。我正在使用Gtk(来自pygobject3.18.2)创建一个窗口。我也使用win32ui(来自pywin32221)。当我导入这两个模块时,我的程序运行正常,直到我关闭它。窗口正常关闭,但python进程继续运行,用于运行脚本的cmd窗口没有返回decmd提示符。我必须杀死python才能返回提示符这是一个简单的测试脚本。这在我的系统上没有正确关闭。如果我注释掉#importwin32ui它会正常关闭fromgi.repositoryimportGtkimportwin32uiclassWindow(Gtk.Window):def_

python - Windows下的PyGObject : Could not locate gdk_pixbuf_new_from_file

我正在尝试使用GdkPixbuf.Pixbuf.new_from_file()从文件创建一个新的pixbuf,但是Python解释器给我以下错误:GLib.Error:g-invoke-error-quark:Couldnotlocategdk_pixbuf_new_from_file:'gdk_pixbuf_new_from_file'奇怪的是new_from_file_at_size()没有给出任何错误并且按预期工作。我在Windows10、Python3.4下工作,我已经从here安装了PyGObject. 最佳答案 看来有一

python - 完全混淆了 GTK、GTK+、GTK+3、PyGobject 等

我正在尝试找出是否可以使用适用于Windows的Python3.2.2或更高版本编写基于Python的Windows桌面小部件。上述项目完全令人困惑。他们中的任何一个支持我正在寻找的东西吗?(即可以与windows和python3.2.2及更高版本一起使用?我确实遇到了这个答案(https://askubuntu.com/questions/97023/why-cant-i-import-pygtk-with-python-3-2-from-pydev),但它看起来只适用于非Windows平台。如果以上这些python项目都不能与windows和python3.2.2一起使用,是否有更

python - Python Gtk+3 中的排序和过滤树模型..?

我正在尝试获得一个可以过滤和排序的树模型(实际上是一个列表存储)。我有以下一段代码self.modelfilter=self.liststore.filter_new()self.modelfilter.set_visible_func(\self._visible_filter_function)self.treeview.set_model(self.modelfilter)其中self.liststore和self.treeview是标准的Gtk.ListStore和Gtk.TreeView对象我从一个林间空地文件中获取,self._visible_filter_function

python - 在 GTK3 中显示股票图标的非弃用方式是什么?

我正在使用PyGObject组装一个GUI。此Python代码在上下文中工作。我得到一个带有常用“打开”图标的工具栏按钮。fromgi.repositoryimportGtk#...toolbar=Gtk.Toolbar()toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)#...self.fileOpen=Gtk.ToolButton.new_from_stock(Gtk.STOCK_OPEN)self.fileOpen.connect("clicked",self.on_FileOpenSta

python - 我必须安装什么来解决 Could not find any typelib for GtkSource, Cannot import : GtkSourceView, cannot import name GtkSource

我正在尝试为来自https://bugzilla.gnome.org/show_bug.cgi?id=680569的meld应用补丁我自己,我遇到了这个问题:$gitclonegit://git.gnome.org/meld$cdmeld$pythonsetup.pybuild$bin/meld2014-01-1116:30:44,736ERRORroot:CouldnotfindanytypelibforGtkSourceCannotimport:GtkSourceViewcannotimportnameGtkSource我对Python知之甚少,例如不知道(还)什么是Python的

python - "Allocating size to..."在 Gtk.ScrolledWindow 中使用 Gtk.TreeView 时出现 GTK 警告

我在我的GTK3应用程序中收到以下警告:Gtk-WARNING**:Allocatingsizeto__main__+MCVEWindow0000000004e93b30withoutcallinggtk_widget_get_preferred_width/height().Howdoesthecodeknowthesizetoallocate?当包含Gtk.TreeView的Gtk.ScrolledWindow附加到网格时会出现警告,而网格本身附加到gtk.ApplicationWindow并且有足够的元素让滚动条实际出现。如果没有足够的元素使其可滚动,则不会出现警告。import

python - 对 pygtk3 的自省(introspection)可能吗?

python的一大优点是能够对方法和函数进行自省(introspection)。例如,要获取math.log的函数签名,您可以(在ipython中)运行此命令:In[1]:math.log?Type:builtin_function_or_methodBaseClass:StringForm:Namespace:InteractiveDocstring:log(x[,base])Returnthelogarithmofxtothegivenbase.Ifthebasenotspecified,returnsthenaturallogarithm(basee)ofx.并且看到x和可选的b

python - 如何使用 GTK3 和 PyGObject 绘制 GdkPixbuf

我有一个小型应用程序,它使用DrawingArea使用PyGObject和GTK3绘制简单的map。我使用加载一个Pixbuffromgi.repositoryimportGtk,GdkPixbufpixbuf=GdkPixbuf.Pixbuf.new_from_file_at_size("logo.png",25,25)然后尝试在DrawingArea的绘图事件信号中绘制它defdraw(self,widget,context):window=widget.get_window()ctx=window.cairo_create()ctx.set_source_pixbuf(pixbu

python - 与 main 一起终止 GObject.Mainloop() 线程

我有以下两个线程:myThread=threading.Thread(target=sender.mainloop.run,daemon=True)myThread.start()myThread2=threading.Thread(target=receiver.mainloop.run,daemon=True)myThread2.start()目标是GObject.Mainloop()方法。之后我的主程序陷入无限循环。我的问题是,当执行被CTRL-C终止时,两个线程都会引发键盘异常,但主程序不会终止。有什么想法可以让CTRL-C终止主程序和两个线程吗?