# import tkinter module
import tkinter
from tkinter import *
from tkinter.ttk import *
from tkinter import messagebox # MessageBOX
import datetime # import module datetime
from tkinter import scrolledtext
def Empty():
txtTableA.configure(state ='normal')
txtTableA.delete('1.0', END)
txtTableA.update()
txtTableA.configure(state ='disabled')
strTxtNumber.set("")
def check_submit() :
Nom = str(strTxtNumber.get())
x = datetime.datetime.now()
txtTableA.configure(state ='normal')
txtTableA.delete('1.0', END)
txtTableA.update()
txtTableA.insert(INSERT,"\n"+str(x))
txtTableA.insert(INSERT,"\n"+" Time Table " + str(Nom)+"\n\n")
for a in range(1,51):
hasildarab = a*int(Nom)
jawapan = str(a).rjust(4)+" x ".rjust(4)+str(Nom)+" = ".rjust(4)+str(hasildarab)
txtTableA.insert(INSERT,"\n"+str(jawapan))
# Create a windowA with size 400 x 500
windowA = Tk()
windowA.title ("TIME TABLE CALCULATOR")
windowA.geometry( "800x500")
windowA.maxsize( 800, 500 )
windowA.config(background = "#82E0AA")
# To create a label
lblTimetable = Label( windowA , text ="Time Table Calculator")
lblTimetable.config(font=("Rockwell",18,"bold italic"), foreground="BLUE" , background="")
lblTimetable.place( x = 280 , y = 30 )
# To create a label
lblNumber = Label( windowA , text ="Number :")
lblNumber.config(font=("Arial",14,"bold"), foreground="#131111" , background="lightpink")
lblNumber.place( x = 50 , y = 70 )
# To Create a TextBox for Number
# TEXTBOX
strTxtNumber = StringVar()
TxtNumber = Entry( windowA, textvariable=strTxtNumber)
TxtNumber.place ( x=150, y=70, width= 150 , height = 25 )
btnSubmit =Button( windowA, text="Submit", command = check_submit)
btnSubmit.place( x= 400 , y=70 , width= 80 , height = 30)
btnSubmit.config(state=NORMAL)
btnClear =Button( windowA, text="Clear", command = Empty)
btnClear.place( x= 500 , y=70 , width= 80 , height = 30)
btnClear.config(state=NORMAL)
#ScrolledText
txtTableA = scrolledtext.ScrolledText(windowA,width=50 , height=20)
txtTableA.place(x=150 , y = 100)
txtTableA.grid(column=0,row=0 , pady = 150, padx = 50)
# Making the text read only
txtTableA.configure(state ='disabled')
ImageGal = PhotoImage ( file ="Girl.png")
lblGambar = Label (windowA, image=ImageGal, relief ="groove", borderwidth=2)
lblGambar.place (x=500, y=150, width=200 , height=300)
windowA.mainloop()
Click Show code , click the main.py for show the python code
click run for testing the Output
click the max window for view the full page