import pyautogui
import time
from tkinter import *
import os
import tkinter
import customtkinter
from tkinter.filedialog import askopenfilename
from PIL import Image
import win32clipboard as clip
import win32con
from io import BytesIO
customtkinter.set_appearance_mode("dark")
customtkinter.set_default_color_theme("blue")
script_dir = os.path.dirname(__file__)
app = customtkinter.CTk() #using cutomtkinter instead of tkinter
app.title('Flyer Blaster')
try:
icon = PhotoImage(file=os.path.join(script_dir, "icon.ico"))
app.iconphoto(False, icon)
except Exception as e:
print('icon not found')
app.geometry("400x240")
text_var = tkinter.StringVar(value="No of groups") #number of groups in which you want to send flyers
wait = tkinter.StringVar(value="No of seconds After\n I should restart") #after how many seconds program should restart to continue the loop
image_var = tkinter.StringVar(value="no flyer selected")
after_loop = None
#functions
def start():
try:
sleep_time = int(wait_var.get())
except Exception as e:
window = customtkinter.CTkToplevel()
window.geometry("400x100")
window.title('Error')
print('sleep time not given')
# create label on CTkToplevel window
label = customtkinter.CTkLabel(window, text='please enter integer with no gaps and select flyer', text_color='red')
label.pack(side="top", fill="both", expand=True, padx=4, pady=4)
return
global after_loop
after_loop = app.after(sleep_time, run(sleep_time))
startbutton.configure(text="Stop", command=stop)
def stop():
app.after_cancel(after_loop)
startbutton.configure(text="Start", command=start)
def run(sleep_time):
#cant add the full code because it is too long you should visit the source for full code