Error when try to run the full Login app
this is what I used when
pyinstaller --noconfirm --onefile --windowed
"C:/Users/Administrator/Documents/VS CODE DEVELOPMENT/Micheal app/Tkinter Login Page/LoginPage.py"
Also the current login app has no images or data for now, all has be removed to track the error but after removing all images I have the code below. The sample app is runing as desired but after converting to exe, the error message as shown in the image below is seen. how can I resolve this?
from captcha.image import ImageCaptcha
import random
# Define a function to generate a random captcha string
def generate_captcha():
# Define the character set for the captcha
char_set = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
captcha = ''
# Generate a random 6-character captcha string
for i in range(6):
captcha += random.choice(char_set)
return captcha
# Define a function to create a captcha image and display it in the GUI
def create_captcha_image():
captcha = generate_captcha()
image = ImageCaptcha().generate(captcha)
# Convert the captcha image to a Tkinter PhotoImage
photo = tk.PhotoImage(data=image.getvalue())
captcha_label.configure(image=photo)
captcha_label.image = photo
return captcha
# Define a function to handle the form submission
def submit_form():
email = email_entry.get()
password = password_entry.get()
user_captcha = captcha_entry.get()
# Validate the captcha
if user_captcha == captcha_text:
print(f"Email: {email}\nPassword: {password}")
# Add code to create the account here
else:
print("Incorrect captcha, please try again.")
create_captcha_image()
# Create a GUI window
root = tk.Tk()
root.title("Create an Account")
# Create a label and entry for the email address
email_label = tk.Label(root, text="Email Address:")
email_label.pack()
email_entry = tk.Entry(root)
email_entry.pack()
# Create a label and entry for the password
password_label = tk.Label(root, text="Password:")
password_label.pack()
password_entry = tk.Entry(root, show="*")
password_entry.pack()
# Create a label and entry for the captcha
captcha_text = generate_captcha()
captcha_label = tk.Label(root)
captcha_label.pack()
captcha_image = ImageCaptcha().generate(captcha_text)
photo = tk.PhotoImage(data=captcha_image.getvalue())
captcha_label.configure(image=photo)
captcha_label.image = photo
captcha_entry = tk.Entry(root)
captcha_entry.pack()
# Create a button to submit the form
submit_button = tk.Button(root, text="Create Account", command=submit_form)
submit_button.pack()
# Run the GUI window
root.mainloop()
I have remove the images but the error is coming from using captcha for the login app. Recommendation or solutions. Thank you.
Image2: The error message after converting using the sample code