On 16/12/2010 22:06, Gerald Britton wrote:
> Hi Dieter,
>
> I just realized that your sample code displays a tooltip per row.
> What I would like to do is display the tip per column. So, if I'm in
> column 3, I see "In column 3" or whatever, regardless of the row. How
> should I modify your sample code to do that?
Replace the on_query_tooltip() method in my previous example with the
snippet below. Note that the "columns" variable holds a gtk.TreeViewColumn
object.
mvg,
Dieter
8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<
def on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip):
if not widget.get_tooltip_context(x, y, keyboard_tip):
return False
else:
model, path, iter = widget.get_tooltip_context(x, y, keyboard_tip)
bin_x, bin_y = widget.convert_widget_to_bin_window_coords(x, y)
result = widget.get_path_at_pos(bin_x, bin_y)
if result is not None:
path, column, cell_x, cell_y = result
if column is not None:
tooltip.set_markup('<b>In column %s</b>' % column.get_title())
widget.set_tooltip_cell(tooltip, path, None, None)
return True
8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/