Browse Source

Add files via upload

master
Unbewohnte 4 years ago committed by GitHub
parent
commit
7a2aa1dbe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      main.py

30
main.py

@ -42,6 +42,7 @@ def main():
stop_bttn = tk.Button(window, text = "Stop" , bg = BACK_CLR, font = 20, state = "disabled", command = stop) #, command = switch_to_start stop_bttn = tk.Button(window, text = "Stop" , bg = BACK_CLR, font = 20, state = "disabled", command = stop) #, command = switch_to_start
stop_bttn.place(x = 110, y = 268, width = 100, height = 50) 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 = tk.Label(window, text = "Mouse location", font = 20, bg = BACK_CLR)
location_choose.place(x = 360,y =5, width = 160, height = 30) location_choose.place(x = 360,y =5, width = 160, height = 30)
@ -58,6 +59,9 @@ def main():
location_y = tk.Entry(window, justify = "right") location_y = tk.Entry(window, justify = "right")
location_y.insert(0,0) location_y.insert(0,0)
location_y.place(x = 465,y = 40, width = 50) location_y.place(x = 465,y = 40, width = 50)
entry_cleaner = tk.Button(window,text = "Clear",font = 14, command = clean_entries)
entry_cleaner.place(x = 520, y = 40 , width = 100, height = 20)
# #
#pretender = tk.Checkbutton(window,text = "Pretend to be online",bg = BACK_CLR) #pretender = tk.Checkbutton(window,text = "Pretend to be online",bg = BACK_CLR)
#pretender.place(x = 350, y = 5) #pretender.place(x = 350, y = 5)
@ -72,6 +76,12 @@ def main():
mouse_pos_label.after(100,update_mouse_pos) mouse_pos_label.after(100,update_mouse_pos)
pass pass
def clean_entries():
location_x.delete(0,"end")
location_y.delete(0,"end")
location_x.insert(0,0)
location_y.insert(0,0)
def stop(): def stop():
print("Stopped \n") print("Stopped \n")
start_bttn["state"] = "normal" start_bttn["state"] = "normal"
@ -79,24 +89,28 @@ def main():
pass pass
def start(): def start():
#time.sleep(5)
print("Started") print("Started")
start_bttn["state"] = "disabled" start_bttn["state"] = "disabled"
stop_bttn["state"] = "normal" stop_bttn["state"] = "normal"
time_btwn_clcks_value = float(time_btwn_clcks.get()) time_btwn_clcks_value = float(time_btwn_clcks.get())
try: try:
if float(location_x.get()) > 0 and float(location_y.get()) > 0: if float(location_x.get()) != None and float(location_y.get()) != None:
location_x_value = float(location_x.get()) location_x_value = float(location_x.get())
location_y_value = float(location_y.get()) location_y_value = float(location_y.get())
else:
print("Entries are on default \n") mouse_c.position = (location_x_value,location_y_value)
while mouse_c.position == (location_x_value,location_y_value):
mouse_c.click(mouse.Button.left)
time.sleep(time_btwn_clcks_value)
pass
stop()
except Exception as e: except Exception as e:
print("Error ! ",e) print("Error ! ",e)
location_x.delete(0,"end") clean_entries()
location_y.delete(0,"end") stop()
location_x.insert(0,0)
location_y.insert(0,0)
pass pass
### ###

Loading…
Cancel
Save