1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | from tkinter import * from tkinter import ttk from pynput import mouse #마우스, 키보드 모니터링 라이브러리 root = Tk() root.title("마우스 좌표 찾기") root.geometry("300x300") ######################################## entry1 = ttk.Entry(root, width=10 ) entry1.grid(row=0, column=1) entry2 = ttk.Entry(root, width=10 ) entry2.grid(row=0, column=2) button1 = ttk.Button(root, text="마우스위치", command = lambda:aaa()) button1.grid(row=0, column=3) ######################################## def aaa(): with mouse.Listener( #마우스 모니터링 on_click=bbb ) as listener: listener.join() ccc() def bbb(x, y, button, pressed): if pressed: global x1 global y1 x1 = x y1 = y if not pressed : return False def ccc(): entry1.delete(0,"end") #처음부터 끝까지 삭 entry2.delete(0,"end") entry1.insert("end",x1) #끝에 입력 entry2.insert(0,y1) #처음에 입력 root.mainloop() | cs |
'파이썬' 카테고리의 다른 글
파이썬 xlrd 엑셀 시트값 읽기 (0) | 2019.03.16 |
---|---|
네이버 단체메일 발송 (파이썬+엑셀파일) (0) | 2019.03.16 |
파이썬 tkinter + pynput + pyautogui 좌표 반복 클릭앱 오토마우스 (0) | 2019.02.15 |