i'm try to make login/ register page in Tkinter (customTkinter). i want to add image captcha but idk why some times captcha show and some time not
from PIL import Image, ImageTk
import customtkinter as ctk
import random,string,os,re,requests,time,customtkinter
from tempfile import mkdtemp
from captcha.image import ImageCaptcha
app = customtkinter.CTk()
app.geometry("500x400")
app.title("Doux")
def main():
image = ImageCaptcha(width = 280, height = 90)
captcha_text = ''.join(random.choices(string.ascii_letters + string.digits, k=6))
dir = mkdtemp()
image.write(captcha_text, dir+ f"\\CAPTCHA-{captcha_text}.png")
print(captcha_text)
render = ImageTk.PhotoImage(Image.open(dir + f"/CAPTCHA-{captcha_text}.png").resize((280, 90), Image.Resampling.LANCZOS))
img = ctk.CTkLabel(app, image=render)
img.place(relx=0.5, rely=0.35, anchor='center')
app.mainloop()