From 874fc233302d9a9db1af9291b36652132381a7c6 Mon Sep 17 00:00:00 2001 From: Unbewohnte <65883674+Unbewohnte@users.noreply.github.com> Date: Wed, 30 Sep 2020 07:34:02 +0300 Subject: [PATCH] Add files via upload --- main.py | 64 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/main.py b/main.py index bf4319b..e1b668d 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ import pynput,sys,random,time,pyautogui -from pynput import mouse,keyboard +from pynput import mouse,keyboard ### keyboard Listener ###Number of clicks (0 - infinite) import tkinter as tk def main(): @@ -25,6 +25,9 @@ def main(): canvas = tk.Canvas(window,width = 700,height = 320, bg = BACK_CLR) canvas.pack() # + #listener = keyboard.Listener(on_press= switch_to_start) + #listener.start() + # global mouse_pos_label mouse_pos_label = tk.Label(window,text = mouse_c.position,font = 24,bg = BACK_CLR) mouse_pos_label.after(100,update_mouse_pos) @@ -37,8 +40,12 @@ def main(): time_btwn_clcks.place(x = 5,y = 0,width = 200) # global start_bttn - start_bttn = tk.Button(window,text = "Start", command = switch_to_stop,bg = BACK_CLR, font = 20) - start_bttn.place(x = 0, y = 270, width = 60, height = 50) + start_bttn = tk.Button(window,text = "Start",bg = BACK_CLR, font = 20) #, command = switch_to_stop + start_bttn.place(x = 5, y = 268, width = 100, height = 50) + + global stop_bttn + stop_bttn = tk.Button(window, text = "Stop" , bg = BACK_CLR, font = 20, state = "disabled") #, command = switch_to_start + stop_bttn.place(x = 110, y = 268, width = 100, height = 50) # location_choose = tk.Label(window, text = "Mouse location", font = 20, bg = BACK_CLR) location_choose.place(x = 360,y =5, width = 160, height = 30) @@ -68,31 +75,32 @@ def main(): mouse_pos_label.after(100,update_mouse_pos) pass - def switch_to_stop(): - STARTED = True - # - start_bttn.destroy() - global stop_bttn - stop_bttn = tk.Button(window,text = "Stop", command = switch_to_start, bg = BACK_CLR, font = 20) - stop_bttn.place(x = 0, y = 270, width = 60, height = 50) - # - time_btwn_clcks_value = float(time_btwn_clcks.get()) - if location_x == '' and location_y == '': - location_x_value = float(location_x.get()) - location_y_value = float(location_y.get()) - else: - print("No values for mouse mos") - print("Starded : ",STARTED) - print("Got value from time_btwn_clcks : {} \n".format(time_btwn_clcks_value)) - pass - - def switch_to_start(): - STARTED = False - stop_bttn.destroy() - start_bttn = tk.Button(window,text = "Start", command = switch_to_stop,bg = BACK_CLR, font = 20) - start_bttn.place(x = 0, y = 270, width = 60, height = 50) - print("Starded : ",STARTED) - pass + # def switch_to_stop(): + # STARTED = True + # # + # start_bttn.destroy() + # global stop_bttn + # stop_bttn = tk.Button(window,text = "Stop", command = switch_to_start, bg = BACK_CLR, font = 20) + # stop_bttn.place(x = 0, y = 270, width = 60, height = 50) + # # + # time_btwn_clcks_value = float(time_btwn_clcks.get()) + # if location_x == '' and location_y == '': + # location_x_value = float(location_x.get()) + # location_y_value = float(location_y.get()) + # else: + # print("No values for mouse mos") + # + # print("Starded : ",STARTED) + # print("Got value from time_btwn_clcks : {} \n".format(time_btwn_clcks_value)) + # pass + # + # def switch_to_start(): + # STARTED = False + # stop_bttn.destroy() + # start_bttn = tk.Button(window,text = "Start", command = switch_to_stop,bg = BACK_CLR, font = 20) + # start_bttn.place(x = 0, y = 270, width = 60, height = 50) + # print("Starded : ",STARTED) + # pass ###