my_list= list(map(int,e1_str.get().split(','))) # List of elements
By using len() we will get Number of elements in the list.import tkinter as tk
my_w = tk.Tk()
my_w.geometry("550x250") # width x heiht
my_w.title("plus2net.com") # Adding a title
font1=['Times',22,'normal'] # Higher font style
font2=['Times',16,'normal'] # font style
lb1 = tk.Label(my_w, text='Numbers',font=font1 ) # added one Label
lb1.grid(row=1,column=1)
e1_str=tk.StringVar() # string variable
e1 = tk.Entry(my_w, width=20,bg='yellow',font=font1,textvariable=e1_str)
e1.grid(row=1,column=2)
b1=tk.Button(my_w,text='Submit',font=font1,command=lambda:my_upd())
b1.grid(row=1,column=3,padx=5,pady=10)
# Single lable showing multiple lines
lb2 = tk.Label(my_w, text='Welcome \n 2nd line \n third', height=4,
font=font2,anchor='w',justify='left',width=40,bg='lightgreen' )
lb2.grid(row=2,column=1,padx=10,columnspan=3,sticky='w')
def my_upd():
my_list= list(map(int,e1_str.get().split(','))) # List of elements
str1=" No. of Elements : " + str(len(my_list))
str1=str1 + "\n Sum of elements: " +str(sum(my_list))
str1=str1 + "\n Average : " +str(sum(my_list)/len(my_list))
lb2.config(text=str1) # Update the text option
my_w.mainloop()
Tkinter Entry Show Hide Password Using Checkbutton
Tkinter Text
How to Validate user entered data
JavaScript Application to convert Feet to Meter and vice versa
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.