Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question # 7 dropdown complete the code in this program that responds t…

Question

question # 7
dropdown
complete the code in this program that responds to moving a mouse over a message box.
from tkinter import *
def motion(event):
print(\location: (\,event. ◯ , \,\, event. ◯ , \)\)
return
mywindow = tk()
eventarea = message( mywindow, text = hello)

Explanation:

Step1: Identify coordinates in Tkinter

In Tkinter, when handling mouse - motion events, the x and y attributes of the event object represent the horizontal and vertical coordinates respectively.

Step2: Fill in the blanks

The code should print the x and y coordinates of the mouse position when it moves over the message box. So the blanks should be filled with x and y.

Answer:

print("Location: (",event.x,":", event.y,")")