I have read this question but its answer does not work for me, so this is not its duplicate.
This problem is happening on a project I have, where I essentially have separated the GUI module and the main module. From the main module I initialize the GUI which should in turn make the status icon (i.e. set the icon and title of it) but despite my efforts its label always reads the name of the python script.
The project's faulty code is analog to the following:
import gtk
class Main:
def __init__(self):
self.statusicon = gtk.StatusIcon()
self.statusicon.set_from_icon_name('call-end-symbolic')
self.statusicon.set_title('Title reads')
self.cb = gtk.combo_box_new_text() # Faulty line
gtk.main()
if __name__ == '__main__':
instance = Main()
As ridiculous as might seem, by removing the "faulty line" the code works perfectly, i.e. the title is set. However, if one does not remove that line, the title is not set, and the script name remains as title.
I read the PyGTK documentation, and it says that the gtk method called in the faulty line is deprecated - that I should use gtk.ComboBoxText()
instead; however, I cannot find the gtk.ComboBoxText
within my gtk
module:
>>> dir(gtk.ComboBoxText)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ComboBoxText'
I guess this question is more in need for a bug report than an answer, but if I am wrong please correct me.