Answer the question
In order to leave comments, you need to log in
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
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.
Why is there so much threading?
btn2.bind( '<Button-1>', btn_click2()) # Если без многопоточности
btn2.bind( '<Button-1>', thread1.start()) # Если с многопоточностью
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question