-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLove_Calculator.py
43 lines (36 loc) · 1.1 KB
/
Love_Calculator.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Python Tkinter GUI Based 'Love Calculator'
from tkinter import *
import random
# Creating GUI Window
root = Tk()
root.geometry('400x240')
root.title('Love Calculator...❤️')
# Function to Calculate Love Percentage
def calculate_love():
# Value Will Contain Digits Between 0-9
st = '0123456789'
# Result Will be in Double Digits
digit = 2
temp = " ".join(random.sample(st, digit))
result.config(text=temp)
# Heading on Top
heading = Label(root, text="Love Calculator(●'◡'●)")
heading.pack()
# Slot/Input for the First Name
slot1 = Label(root, text="Enter Your Name: ")
slot1.pack()
name1 = Entry(root, border=5)
name1.pack()
# Slot/Input for the Partner Name
slot2 = Label(root, text="Enter Your Partner Name: ")
slot2.pack()
name2 = Entry(root, border=5)
name2.pack()
# Create a Button and Place at a Particular
bt = Button(root, text="Calculate", height=1, width=7, command=calculate_love)
bt.pack()
# Text on Result Slot
result = Label(root, text='Love Percentage Between Both of You:')
result.pack()
# Starting the GUI
root.mainloop()