Python GUI Multiplication Table

By | March 30, 2020

Topic: Multiplication Table Python GUI Program

Multiplication Table Python GUI Program

Python GUI Multiplication Table

# Python GUI program Multiplication Table
# Input a number and show its multiplication table
# from 1 to 10

from tkinter import *

def show_table():
	num = int(entry.get())
	str1=' Table of ' + str(num) + '\n-----------------\n'
	for i in range(1,11):
		str1 = str1 + " " + str(num) + " x " + str(i) + " = " + str(num*i) + "\n"

	output_label.configure(text = str1, justify=LEFT)
main_window = Tk()
main_window.title("Perfect Python tkinter Tutorials :")
message_label = Label(text= ' Enter a number to \ndisplay its Table ' ,
font=( ' Verdana ' , 12))
output_label = Label(font=( ' Verdana ' , 12))
entry = Entry(font=( ' Verdana ' , 12), width=6)
calc_button = Button(text= ' Show Multiplication Table ' , font=( ' Verdana ', 12), 
message_label.grid(row=0, column=0,padx=10, pady=10)
entry.grid(row=0, column=1,padx=10, pady=10, ipady=10)
calc_button.grid(row=0, column=2,padx=10, pady=10)
output_label.grid(row=1, column=0, columnspan=3,padx=10, pady=10)

How this Program works?

  • We use Python tkinter module to create GUI of this application
  • First of all we create a main window for the program.
  • we set the title of the main window.
  • create a label widget with message “Enter a number to dislay its table”.
  • create a text box / entry widget to get the user input
  • create a button and attached a function show_table() using command=show_table.
  • Hence when the user will input a number in the entry widget and click on the button, the show_table() function will execute.
  • This show_table() function uses a for loop with range() function to display the multiplication table
    in a label.

Perfect Programming Tutorials, Python , Java, C Language, C++


You would also like Python GUI Programs usin tkinter Module:

  1. Python GUI Temperature Conversion Program Celsius to Fahrenhiet
  2. Python GUI Program Temperature Conversion Fahrenheit to Celsius
  3. Python Pounds to Kilogram Converter GUI tkinter Program
  4. Python 3 Four Function Calculator Program tkinter GUI
  5. Python Digital Clock Program using tkinter GUI
  6. Python Quotes Changer Program tkinter GUI
  7. Python 3 tkinter Spinbox GUI Program Example
  8. Python 3 tkinter Message Widget Program Examples
  9. Python 3 GUI Program tkinter Radio Buttons
  10. Adding Menus to Python 3 tkinter GUI Programs
  11. Python 3 GUI Program Add Two Numbers
  12. Python 3 GUI Miles to Kilometers Converter tkinter Program
  13. Python 3 tkinter GUI Kilogram to Pounds Program
  14. Python Set Label Text on Button Click tkinter GUI Program
  15. Show Label and Button Widgets Python Tkinter Program
  16. Python GUI Program Area of Triangle with base and height
  17. Python 3 Tkinter GUI Hello World Program
  18. Create and Show Root Window of tkinter GUI Program



One thought on “Python GUI Multiplication Table

  1. Pingback: Python Function Table of Number from Start to End |

Leave a Reply

Your email address will not be published. Required fields are marked *