How do I write indicators using Python and GTK3?

David Planella david.planella at ubuntu.com
Tue Feb 28 15:26:02 UTC 2012


Al 28/02/12 15:59, En/na Ted Gould ha escrit:
> On Tue, 2012-02-28 at 11:09 +0100, David Planella wrote:
>> Al 27/02/12 15:56, En/na Jo-Erlend Schinstad ha escrit:
>>> I'm writing an application that needs to use an indicator. I've done
>>> this in the past using PyGTK and GTK2, using as reference this document:
>>> https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Python_version
>>>
>>>
>>> However, that only works with PyGTK and GTK2. Things have changed since
>>> then, and I need to find some good documentation, a tutorial or a good
>>> example to learn how it works. If no tutorial exists, then I can write
>>> one – when I learn how it works. :)
>>>
>>
>> I'm CC'ing Ted Gould and Mike Hall, who might be able to provide more
>> guidance.
>
> That's me!  :-)
>
> So I haven't put together an example, but for GTK3 the GObject
> Introspection bindings should be used.  So to include appindicator you'd
> need to do something like this:
>
>    from gi.repository import AppIndicator
>
> This changes things slightly because the GIR auto-bindings in Python end
> up being slightly different than the old ones.  But, in general, they
> should also be more up-to-date with library changes :-)
>
> 		--Ted
>

Thanks Ted!

I just had a chat with Ted on IRC, and it seems you have to use

from gi.repository import AppIndicator3

i.e. you need to specify the GTK3 version of the AppIndicator bindings.

I've also updated the following:

AppIndicator Python example:
- 
https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators#Python_version

AppIndicator GTK3 bindings API documentation:
- http://developer.ubuntu.com/api/ubuntu-12.04/python/AppIndicator3-0.1.html

Cheers,
David.



More information about the Ubuntu-app-devel mailing list