-
Notifications
You must be signed in to change notification settings - Fork 0
/
teste.py
70 lines (48 loc) · 1.32 KB
/
teste.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from tkinter import *
import win32con, win32api
from pynput.mouse import Controller
import time
import _thread
root = Tk()
valor = StringVar()
class Aplicacao(Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
global valor
txt = Entry(self, width=10, textvariable=valor)
txt.grid(column=1, row=0)
txt.focus_set()
def on_delete(self):
print("Ok")
def loop(self):
manter = True
time.sleep(1)
while (manter):
mouse = Controller()
global valor
print(valor.get())
if(valor.get() != "A"):
#print('The current pointer position is {0}'.format(
#mouse.position))
win32api.SetCursorPos((800, 300))
else:
manter = False
def task(task_name, delay):
if(task_name == "1"):
print("passou1")
if(task_name == "2"):
print("passou2")
app.loop()
root.geometry('1000x600')
root.resizable(0, 0)
app = Aplicacao(master=root)
root.protocol("WM_DELETE_WINDOW", app.on_delete)
_thread.start_new_thread(task,("1", 0))
_thread.start_new_thread(task,("2", 0))
app.mainloop()
while 1:
pass