Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 8899  / 1 Year ago, sat, january 21, 2023, 7:44:20

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.



Also, one thing that the previously mentioned document doesn't describe at all, is how to add sub-menus to an indicator. I hope someone can shed some light on this, as well as how to integrate with category indicators if that's done using the same tool.



Thanks.


More From » indicator

 Answers
5

This is my trial code for gtk3 and appindicator which creates a indicator for GPaste.



Basically,



from gi.repository import AppIndicator3 as AppIndicator


in order to use appindicator for gtk3 applications which is provided by package gir1.2-appindicator3.



Here is the AppIndicator3 documentation.



pygtk will be deprecated for Gtk3 and you have to go through GObject-Introspection route for developing Gtk3 applications in python. You can refer to PyGObject documentation. Instead of



import pygtk, gtk, gdk, gobject, pango  


etc you should do



from gi.repository import Gtk, Gdk, Pango, GObject  


For studying a working code, you could view Kazam which has moved to gtk3 from gtk2 and uses appindicator3.



There is a package gir1.2-appindicator as well which seems to be same as using python-appindicator as they both provide usage for gtk2 appplication which is:



from gi.repository import AppIndicator


OR



import appindicator


Some information in this blog post as well.


[#40140] Monday, January 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bearous

Total Points: 226
Total Questions: 116
Total Answers: 136

Location: Guernsey
Member since Sun, Jan 10, 2021
3 Years ago
;