O
O
Oleksandr Shengera2021-10-26 14:39:09
Python
Oleksandr Shengera, 2021-10-26 14:39:09

How to deal with multithreading in python?

When I press the start autoclicker button, nothing happens, what should I do?

def btn_click():
  from tkinter import messagebox
  messagebox.showinfo(title="window", message="ENG:[hold v to autoclick][press Alt + 0 to close program]")
def btn_click2():
  thread1.start()
  start_key = "v"
  stop_key = "Alt + 0"
  from tkinter import messagebox
  messagebox.showinfo(title="window", message="[AutoClicker started^_^]")
  while True:
    if key.is_pressed(start_key):
      time.sleep(0,11)
      mouse.double_click(button = "left")
    if key.is_pressed(stop_key):
      break

root["bg"]="#fafafa"
root.title("AutoClicker")
root.wm_attributes("-alpha", 1)
root.geometry("280x180")

root.resizable(width=False, height=False)
canvas=tk.Canvas(root, height=280, width=180)
canvas.pack()

frame=tk.Frame(root, bg="#C4AAB7")
frame.place(relwidth=1, relheight=1)
frame.place()

title=tk.Label(frame, text="by Oleksandr1337", bg="#C4AAB7", font="40")
title.pack()

btn=tk.Button(frame, text="instruction", bg="white", padx="65", pady="10", command=btn_click)
btn.pack()


thread1=Thread(target=btn_click2)

btn2=tk.Button(frame, text="start AutoClicker", bg="white", padx="50", pady="10")
btn2.pack()
root.mainloop()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vindicar, 2021-10-26
@Vindicar

btn2=tk.Button(frame, text="start AutoClicker", bg="white", padx="50", pady="10")
Why should something happen here? I don't see a click handler for this button in your code.

A
Alexander Ananchenko, 2021-10-27
@Shurik24

Why is there so much threading?

btn2.bind( '<Button-1>', btn_click2()) # Если без многопоточности

btn2.bind( '<Button-1>', thread1.start()) # Если с многопоточностью

and time.sleep(0,11) won't work, he doesn't like commas he's evil, dot time.sleep(0.11)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question