when I enter small number in the screen then it works fine but when I enter large number it stops working and not responding to any user input I have used OverflowError but it doesn't seems to work. Pls help me out
from tkinter import *
from tkinter import messagebox as msb
import math
root = Tk()
root.geometry("500x200")
# screen to write the number
screen_val = StringVar()
screen = Entry(root, textvariable=screen_val, font="Aerial 33")
screen.pack(fill=BOTH)
factorial_question = ""
def factorial():
global factorial_question
try:
factorial_question = screen_val.get()
if "Answer : " in screen_val.get():
factorial_question = factorial_question.replace("Answer : ", "")
factorial_answer = math.factorial(int(factorial_question))
screen_val.set("Answer : " + str(factorial_answer))
screen.update()
except OverflowError:
if "Answer : " in screen_val.get():
factorial_question.replace("Answer : ", "")
msb.showwarning("Error", "Value too long")
except ValueError:
msb.showwarning("Error", "write the correct number")
button_factorial = Button(root, text="!", font="aerial 15 bold", borderwidth=10, bg="light yellow", pady=14,padx=15,command=factorial)
button_factorial.pack()
root.mainloop()