Lompat ke konten Lompat ke sidebar Lompat ke footer

Python Tkinter Multiplication Table

How To Create Multiplcation Table In Tkinter Using Python

How To Create Multiplcation Table In Tkinter Using Python Python Tkinter Multiplication Table

in this Python Tkinter tutorial we will see how to make a multiplication table using treeview.

Source Code:

import tkinter as tk
from tkinter import *
from tkinter import ttk


root = Tk()
root.title("Multiplication Table")

frame_container = tk.Frame(root, padx=10, pady=10, bg='#badc58')

# create treeview
trv = ttk.Treeview(frame_container, columns=(1,2,3,4,5,6,7,8,9), show='headings')


# function to add columns and rows to the Treeview (Multiplication Table)
def createMultiplicationTable():
# add columns to the treeview
for i in range(0,10):
trv.column(i, anchor='center', width=100)
trv.heading(i, text='[ ' + str(i) + ' ]')
# add rows to the Treeview
for j in range(1,11):
numbers = []
for c in range(1,11):
numbers.append(str(j) + " x " + str(c) + " = " + str(j*c))
if c == 10:
trv.insert("",'end', iid=j, values=numbers)



createMultiplicationTable()

trv.pack()
frame_container.pack()

root.mainloop()

OUTPUT:

How To Create Multiplcation Table In Tkinter Using Python Python Tkinter Multiplication Table





▶ Download Python Projects Source Code

Posting Komentar untuk "Python Tkinter Multiplication Table"