This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 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
#niwantha33@gmail.com
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()