Skip to content
Related Articles

Related Articles

Multiplication Table Generator using Python

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 25 Feb, 2021
Improve Article
Save Article

Prerequisites: Python GUI- Tkinter

We all know that Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. In this article, we will learn How to create a Times-table using Tkinter.


  • Import Tkinter Library
  • Create Function of Multiplication Table
  • Create the main window (container)
  • Create Variabletext field that store value of Number
  • Call the function By Generate Table Button
  • Execute code



#import library
import sys
from tkinter import *
def MultiTable():
    print("\n:Multiplication Table:\n")
    print("\nTimes-Table of Number", (EnterTable.get()), '\n')
    for x in range(1, 13):
        number = int(EnterTable.get())
        print('\t\t', (number), 'x', (x), '=', (x*number),)
# Create Main window
Table = Tk()
Table.title('Multiplication Table')
# Variable Declaration
EnterTable = StringVar()
label1 = Label(Table, text='Enter Your Times-table Number:',
               font=30, fg='Black').grid(row=1, column=6)
label1 = Label(Table, text='                     ').grid(row=2, column=6)
# Store Number in Textvariable
entry = Entry(Table, textvariable=EnterTable,
              justify='center').grid(row=3, column=6)
label1 = Label(Table, text='                     ').grid(row=4, column=6)
# Call the function
button1 = Button(Table, text="Generate Table", fg="Blue",
                 command=MultiTable).grid(row=5, column=6)
label1 = Label(Table, text='                     ').grid(row=6, column=6)
# Exit
EXIT = Button(Table, text="Quit", fg="red",
              command=Table.destroy).grid(row=7, column=6)


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!