Think about your design.
One textbox user enter 3 number.
Then operator / and then user enter new number and you get and average.
Like a normal calculator.
What if user want average of 5 number,should you create 5 textboks?
Edited 6 Years Ago by snippsat: n/a
Here is a generic program templet that takes 2 numbers, checks the input, processes the entered data and shows the result. The Tkinter GUI toolkit is used. You can easily add additional inputs and change the processing to whatever you want ...
# a general Tkinter program to enter two numbers and process them try: # for Python2 import Tkinter as tk except ImportError: # for Python3 import tkinter as tk def calculate(): """ take the two numbers entered and process them """ try: x = float(enter1.get()) y = float(enter2.get()) # the process step ... s = str(x + y) label3.config(text=s) except ValueError: label3.config(text='Enter numeric values for x and y') def setfocus2(event): enter2.focus_set() # create the root window root = tk.Tk() # create all the components/widgets label1 = tk.Label(root, text='Enter number x:', width=28) enter1 = tk.Entry(root, bg='yellow') label2 = tk.Label(root, text='Enter number y:') enter2 = tk.Entry(root, bg='yellow') button1 = tk.Button(root, text='Add the numbers', command=calculate) # the result label label3 = tk.Label(root, text='', bg='green') # pack widgets vertically in the root window in that order label1.pack(side='top', fill='x') enter1.pack(side='top', fill='x') label2.pack(side='top', fill='x') enter2.pack(side='top', fill='x') button1.pack(side='top') label3.pack(side='top', fill='x') # cursor in enter1 enter1.focus() # return key in enter1 sets focus to enter2 enter1.bind("<Return>", func=setfocus2) # start the event loop root.mainloop()
Thank you so much Vegaseat!!That was really helpfull!!!Thanks again!!!!
thank you very much
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...