from gi.repository import Gtk,Gdk
import random


def motion_notify(a, b):
	print "motion%d!" % random.randint(0,100)
	return False

def click(a,b):
	print "clicked"
	a.get_window().set_event_compression(False)
	a.props.has_tooltip = True
	return False

def query_tooltip(a,b,c,d,e):
	a.set_tooltip_text("my tooltip!")
	return False


win = Gtk.Window()
win.connect('delete-event', Gtk.main_quit)
win.resize(300,300)

widget = Gtk.EventBox()
btn = Gtk.Label("testing")
widget.set_events(Gdk.EventMask.POINTER_MOTION_MASK
				)
mnid = widget.connect("motion-notify-event", motion_notify)
mnid = widget.connect("button-press-event", click)
mnid = widget.connect("query-tooltip", query_tooltip)
#clid = btn.connect("clicked", click)
widget.add(btn)
win.add(widget)

win.show_all()


Gtk.main();



