Tooltips on comboBox
- From: Alessandro Dentella <sandro e-den it>
- To: gtk-list gnome org
- Subject: Tooltips on comboBox
- Date: Wed, 21 Jan 2009 10:22:07 +0100
Hi, I need to add tooltips on single entries of a ComboBox, but I couldn't
understand if it's any possible. I use PyGtk but pygtk list was not helpful,
so forgive me the example in python.
I tried to add tooltip via gtk.Tooltip widget.
In my attempt to get tooltips I see that as I click on the arrow and the
popup appears, the tooltip disappears.
It seems the popup is a different gtk.Widget, and I should connect to that
one to attach tooltips. Is that correct? and in case how can I have that
widget?
I tried to connect to 'add' signal but it's never triggered. I see the
ComboBox has a child: a CellView, but if I understand correctly CellView
only displayes *one* line and moreover I was not able to add a tooltip
anyhow.
Can somebody clearify which is the way a ComboBox pops a menu and how I can
get to it's components to set a tooltip?
thanks
sandro
*:-)
################################################
import gtk
import datetime
class Test(object):
def __init__(self):
self.w = gtk.Window()
self.v = gtk.VBox()
self.c = gtk.ComboBox()
self.c = gtk.combo_box_new_text()
#print self.c, type(self.c)
for i in "= > < >= <= ~ ~!".split():
self.c.append_text(i)
self.c.set_property('has-tooltip', True)
self.c.connect('query-tooltip', self.on_query_tooltip)
self.w.add(self.v)
self.v.add(self.c)
self.w.show_all()
def on_query_tooltip(self, widget, x, y, keyboard_mode, tooltip):
print widget, x, y, keyboard_mode, tooltip
tooltip.set_text(datetime.datetime.now().strftime('%M:%S'))
return True
if __name__ == '__main__':
t = Test()
gtk.main()
--
Sandro Dentella *:-)
http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]