This calculator has a simple GUI with a text entry box and buttons for numbers, operators, and clear. When the user clicks the '=' button, the calculator evaluates the expression in the entry box and displays the result.
Hydraulics is the principle behind water flow,water behaviour under different environmental conditions as well as its free and guided movement through pipes and channels. Therefore hydraulics is the basic science which helps us understand water behaviour in storage,conveyance,as well as application in the field
Answers & Comments
Verified answer
(◕ᴗ◕✿)
Here's an example code to create a simple calculator using Tkinter in Python:
```
import tkinter as tk
class Calculator:
def __init__(self, master):
self.master = master
master.title("Calculator")
self.entry = tk.Entry(master, width=25, font=('Arial', 14))
self.entry.grid(row=0, column=0, columnspan=4, padx=5, pady=5)
buttons = [
'7', '8', '9', '/',
'4', '5', '6', '*',
'1', '2', '3', '-',
'0', '.', '=', '+'
]
row = 1
col = 0
for button in buttons:
command = lambda x=button: self.click(x)
tk.Button(master, text=button, width=5, height=2, font=('Arial', 14), command=command)\
.grid(row=row, column=col, padx=5, pady=5)
col += 1
if col > 3:
col = 0
row += 1
def click(self, key):
if key == '=':
try:
result = eval(self.entry.get())
self.entry.delete(0, tk.END)
self.entry.insert(tk.END, str(result))
except:
self.entry.delete(0, tk.END)
self.entry.insert(tk.END, 'Error')
elif key == 'C':
self.entry.delete(0, tk.END)
else:
self.entry.insert(tk.END, key)
root = tk.Tk()
calculator = Calculator(root)
root.mainloop()
```
This calculator has a simple GUI with a text entry box and buttons for numbers, operators, and clear. When the user clicks the '=' button, the calculator evaluates the expression in the entry box and displays the result.
Answer:
Hydraulics is the principle behind water flow,water behaviour under different environmental conditions as well as its free and guided movement through pipes and channels. Therefore hydraulics is the basic science which helps us understand water behaviour in storage,conveyance,as well as application in the field
Explanation: