Код: Выделить всё
import keyboard
import tkinter as tkinter
from tkinter import messagebox, Entry
import tkinter as tk
from time import sleep
import pyautogui
isClicking = False
lim = 0
window = tk.Tk()
window.title("Auto Code")
window.geometry('720x360')
file = open('promo.txt', 'r')
def ser():
global lim
lim = text.get()
if lim != '':
text.delete(0, 'end')
else:
tk.messagebox.showinfo("Error", ('Text Empty'))
def tumb():
global isClicking
if isClicking:
isClicking = False
print('Off')
else:
isClicking = True
print('On')
if isClicking:
for i in file and range(int(lim)):
pyautogui.moveTo(1564, 1008)
pyautogui.press('F6')
sleep(0.3)
pyautogui.press('F6')
pyautogui.write(i)
sleep(0.5)
pyautogui.moveTo(838, 584)
pyautogui.press('F6')
sleep(0.2)
pyautogui.press('F6')
sleep(2)
pyautogui.click(977, 733)
pyautogui.press('F6')
sleep(0.2)
pyautogui.press('F6')
sleep(1.5)
text = tk.Entry(fg = "Black", width = 10)
text.place(x = 220, y = 65)
btn = tk.Button(window, text = "Add", command = ser, width = "40", height = "2", fg = "black", bg = "white")
btn.place(x = 220, y =110)
keyboard.add_hotkey('ctrl + v', tumb)
window.mainloop()
file.close()
Подробнее здесь: https://stackoverflow.com/questions/794 ... as-been-ex