Hello ,

I am asking about houw to get a hand form of the mouse when it is over a "Label" , this Label is Clickable and defined like this :

def callback(event):
        print "clicked at", event.x, event.y
        Interface1()

    lab1dep = Label(interf1, text="Departement Informatique" ,bg = "blue" ,font=("times",12, "bold"),  fg = "white" )
    lab1dep.place ( x=40 , y=220)

    lab1dep.bind("<Button-1>", callback)


lab1dep.bind("<Button-1>", callback)`

event.x and event.y have to be within the boundaries of the label. An example using a canvas but similar to what you want

try:
    import Tkinter as tk     ## Python 2.x
except ImportError:
    import tkinter as tk     ## Python 3.x

def point(event):
   x = event.x
   y = event.y
   print "x, y", x, y, type(x)

   ## draw a point at the mouse click location
   canvas.create_oval(x, y, x+5, y+5, fill="black")

   ## calculate the square clicked based on event.x and event.y
   ctr_x = 0
   while x > 100:
      ctr_x += 1
      x -= 100

   ctr_y = 0
   while y > 100:
      ctr_y += 1
      y -= 100

   print "in square (%d, %d)" % (ctr_x, ctr_y)

##-----------------------------------------------------------
root = tk.Tk()
root.title('Canvas Test')
canvas = tk.Canvas(root, width =300, height=300)

canvas.create_line(1, 100, 300, 100, width=3)
canvas.create_line(1, 200, 300, 200, width=3)

canvas.create_line(100, 1, 100, 300, width=3)
canvas.create_line(200, 1, 200, 300, width=3)

canvas.create_text(50,50, text='0', fill='blue', font=('verdana', 36))
canvas.create_text(150,150, text='X', fill='yellow', font=('verdana', 36))

canvas.pack()
canvas.bind("<Button-1>", point)
root.mainloop()

But where is the hand mouse when the cursor is on th "label" ? !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.