在Python 3中使用GIO


8

如何访问gio适用于Python 3.2 的模块?(我想与GVFS交互。)

sudo apt-get install python3-gobject

但这不允许我做

import gio

就像在Python 2.7中一样。Python 3中的GObject不提供GIO模块吗?如何访问?

Answers:


10

gio是PyGTK模块,不适用于Python 3,因为PyGTK本身已被弃用。如果要在Python 3中创建GTK +应用程序,则需要使用其替代品:PyGObject。对于Gio,可以这样导入。

$ python3
Python 3.2.2 (default, Sep  5 2011, 21:17:14) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gio

这样的文档可以在这里找到。祝你好运!


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.