i am making a spam bot to annoy my friends but when i run the code the Tkinter window does not show up. it works with a variable called click_var
. when you press a button the code sends a signal to start clicking. can someone help me?
import pyautogui
from time import sleep
from tkinter import *
window=Tk()
def clicker():
global click_var
global click_text_var
click_var = 0
#if click_var = 0: clicker is off
#if click_var = 1: clicker is on
if click_var == 0:
click_var =+ 1
click_text_var = 'stop'
elif click_var == 1:
click_text_var = "start"
click_var =- 1
else:
print('error1: clickvar not 0/1')
click_text_var = 'start'
click_var = 1
name=Label(window, text="spammer 3000", fg='black', font=("Helvetica", 30))
name.place(x=10, y=10)
clickerbtn=Button(window, text=click_text_var + " clicker", bg='grey', command=clicker)
clickerbtn.place(x=10, y=100)
window.title('the spammer 3000')
window.geometry("600x400+10+20")
window.mainloop
clickerbtn.pack
while click_var == 1:
print('l')
if click_var == 0:
something =+ 1
print('o')
if click_var < 0:
print('error1: clickvar not 0/1')
if click_var > 1:
print('error1: clickvar not 0/1')
you probably just need to add the brackets to the mainloop function window.mainloop()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.