Heyy, I'm trying to create a button that starts a script depending on what it finds in a text sorry if this question is hard to comprehend.
the script (i will shorten it for a simpler example) :
import Tkinter as *
window = Tk()
#locals
Depended = 1 #this is what depends on what script it will start
Active = False #this will start the script
#commands
def check():
global Depended
text = scrolltext.get("1.0", "end") #scrolltext is basically like a tkinter text
find_AutoFishing = text.find("AutoFishing")
find_HoldClick = text.find("HoldClick") #what its looking for
find_SpamClick = text.find("SpamClick")
if find_AutoFishing:
print("found autofish")
Depended = 10
elif find_HoldClick:
print("found holdclick") #what it found
Depended = 20
elif find_SpamClick:
print("found spamclick")
Depended = 30
else:
print("nothing found")
def Start():
global Active
check() #this will start the script
Active = True
t = Thread (target=ATTACK)
t.start()
def Stop():
global Active
global Depended #this will end the script
Active = False
Depended = 1
#scrolltext works the same as Text in Tkinter
scrolltext = scrolledtext.ScrolledText(window, height=11, width=60, bg="#050505", fg="white", bd=0)
scrolltext.pack()
execute_button = Button(main, command=Start)
execute_button.pack()
purge_button = Button(main, command=Stop)
purge_button.pack()
window.mainloop()
basically, the problem I'm running into is when I have the word "SpamClick" in my scrolltext and press execute, the check function will not work and not detect that the work SpamClick was in the scrolltext, but instead of printing "Depended = 1" it will print something like "Depended = 20".
Sorry again if this script is very hard to comprehend, don't spend too much time on the question as iI might come across a solution soon enough since this is my main project at the moment.