-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrist.py
28 lines (20 loc) · 862 Bytes
/
Frist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
from tkinter import Tk, simpledialog, messagebox
# Create a Tkinter root window
root = Tk()
root.withdraw()
while True:
# Get the length and width of the rectangle from the user
length = simpledialog.askfloat("Length", "Enter the length of the rectangle: ")
width = simpledialog.askfloat("Width", "Enter the width of the rectangle: ")
# Calculate the area of the rectangle
area = length * width
# Display the area of the rectangle to the user
messagebox.showinfo("Area", "The area of the rectangle is " + str(area))
# Ask the user if they want to continue
result = messagebox.askyesno("Continue", "Do you want to calculate the area of another rectangle?")
# If the user does not want to continue, break out of the loop
if not result:
break
# Close the Tkinter root window
root.destroy()