Tooltip for Canvas items

Tooltip : Attachment 

I am presently  creating a GUI in python. One of features is when I go on top of any button it should show the name of the button.  Tooltip can do this in python. Unfortunately it doesn’t work with images (My all buttons are made up of images) because it doesn’t consider image as widget. So I have come up with following method to create namebox.

******************************Tooltip for canvas Items ******************************

# Globals
tw = 0
tt_yes = 0
def tooltip_create(text, x,y): # inputs are text = display name; x,y = where should be positioned.
global tw, tt_yes
x -= 5
y += 15
# creates a toplevel window
tw = Toplevel(home_root)
# Leaves only the label and removes the app window
tw.wm_geometry(“+%d+%d” % (x, y))
label =Label(tw, text=text, justify=’left’,
background=’white’, relief=’solid’, borderwidth=1)
tt_yes = 1
def tooltip_close(): # close the namebox window
global tw, tt_yes
if tt_yes:
def  hover_enter(event):
tooltip_create(“Save”, x,y)
def  hover_leave(event):
# Photoimage ( which requires the tooltip)
img_save = PhotoImage(file = image)
canvas.create_image(x= X, y = Y,image=img_save,tags=”hover_functn”)
canvas.tag_bind(“hover_functn “,’<Any-Enter>‘, hover_enter)
canvas.tag_bind(“hover_functn “,’<Any-Leave>‘, hover_leave)