Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import Tkinter as tk
def showxy(event):
xm, ym = event.x, event.y
str1 = "mouse at x=%d y=%d" % (xm, ym)
# show cordinates in title
root.title(str1)
# switch color to red if mouse enters a set location range
x,y, delta = 100, 100, 10
frame.config(bg='red'
if abs(xm - x) < delta and abs(ym - y) < delta
else 'yellow')
root = tk.Tk()
frame = tk.Frame(root, bg= 'yellow', width=300, height=200)
frame.bind("<Motion>", showxy)
frame.pack()
root.mainloop()

View file

@ -0,0 +1,13 @@
#simple way of ,get cursor xy data
from Tkinter import *
win=Tk()
win.geometry("200x300")
def xy(event):
xm, ym = event.x, event.y
xy_data = "x=%d y=%d" % (xm, ym)
lab=Label(win,text=xy_data)
lab.grid(row=0,column=0)
win.bind("<Motion>",xy)
mainloop()