When I run this code of a spambot it gives me the error that the "'StringVar' object is not iterable", I am new to python and I don't really know exactly what that means, if you can help me with an working code of this please post it.
I don't exactly know that the other part of the code is fully working but I made a console one and it s perfectly working.
import tkinter as tk
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
def spam():
time.sleep(2)
while True:
for char in var:
keyboard.press(char)
keyboard.release(char)
time.sleep(0.12)
root = tk.Tk()
var = tk.StringVar()
root.geometry("500x300")
write = tk.Label(text="Insert sentence then print the button:")
button = tk.Button(text="Spam", command = spam)
enter = tk.Entry(root, textvariable = var)
write.pack()
enter.pack()
button.pack()
root.mainloop()