1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
.. _guide-api:
================
GI Documentation
================
This is the API provided by the toplevel "gi" package.
.. function:: gi.require_version(namespace, version)
:param str namespace: The namespace
:param str version: The version of the namespace which should be loaded
:raises: ..py:exception:: ValueError
Ensures the namespace gets loaded with the given version. If the namespace
was already loaded with a different version or a different version was
required previously raises ValueError.
::
import gi
gi.require_version('Gtk', '3.0')
.. function:: gi.require_foreign(namespace, symbol=None)
:param str namespace:
Introspection namespace of the foreign module (e.g. "cairo")
:param symbol:
Optional symbol typename to ensure a converter exists.
:type symbol: :obj:`str` or :obj:`None`
:raises: ..py:exception:: ImportError
Ensure the given foreign marshaling module is available and loaded.
Example:
.. code-block:: python
import gi
import cairo
gi.require_foreign('cairo')
gi.require_foreign('cairo', 'Surface')
.. function:: gi.check_version(version)
:param tuple version: A version tuple
:raises: ..py:exception:: ValueError
Compares the passed in version tuple with the gi version and does nothing
if gi version is the same or newer. Otherwise raises ValueError.
.. function:: gi.get_required_version(namespace)
:returns: The version successfully required previously by :func:`gi.require_version` or :obj:`None`
:rtype: str or :obj:`None`
.. data:: gi.version_info
:annotation: = (3, 18, 1)
The version of PyGObject
.. class:: gi.PyGIDeprecationWarning
The warning class used for deprecations in PyGObject and the included
Python overrides. It inherits from DeprecationWarning and is hidden
by default.
.. class:: gi.PyGIWarning
Like :class:`gi.PyGIDeprecationWarning` but visible by default.
|