Topic: 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 # www.EasyCodeBook.com 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 : www.EasyCodeBook.com") 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), command=show_table) 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) mainloop()
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:
- Python GUI Temperature Conversion Program Celsius to Fahrenhiet
- Python GUI Program Temperature Conversion Fahrenheit to Celsius
- Python Pounds to Kilogram Converter GUI tkinter Program
- Python 3 Four Function Calculator Program tkinter GUI
- Python Digital Clock Program using tkinter GUI
- Python Quotes Changer Program tkinter GUI
- Python 3 tkinter Spinbox GUI Program Example
- Python 3 tkinter Message Widget Program Examples
- Python 3 GUI Program tkinter Radio Buttons
- Adding Menus to Python 3 tkinter GUI Programs
- Python 3 GUI Program Add Two Numbers
- Python 3 GUI Miles to Kilometers Converter tkinter Program
- Python 3 tkinter GUI Kilogram to Pounds Program
- Python Set Label Text on Button Click tkinter GUI Program
- Show Label and Button Widgets Python Tkinter Program
- Python GUI Program Area of Triangle with base and height
- Python 3 Tkinter GUI Hello World Program
- Create and Show Root Window of tkinter GUI Program
Pingback: Python Function Table of Number from Start to End | EasyCodeBook.com