Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_find_xy_of_label.py
- from Tkinter import *
- #Import the tkinter library
- #Create an instance of the tkinter frame
- win = Tk()
- #Define the geometry of the frame
- win.geometry("600x200")
- #Create a button widget
- my_label = Label(win, text="Move Window About And Look At The XY Of It")
- #Configure it using other properties
- my_label.config(font =("Helvetica", 20))
- #Define the position of the widget
- my_label.place(x=14, y=0)
- while 1:
- #Update the coordinates with respect to the tkinter frame
- win.update()
- #Get the coordinates label widget
- widget_x1, widget_y1 = my_label.winfo_rootx(), my_label.winfo_rooty()
- print (widget_x1, widget_y1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement