-
Notifications
You must be signed in to change notification settings - Fork 0
/
love calc.py
53 lines (42 loc) · 1.22 KB
/
love calc.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
44
45
46
47
48
49
50
51
52
53
# Python Tkinter GUI based "LOVE CALCULATOR"
# import tkinter
from tkinter import *
# import random module
import random
# Creating GUI window
root = Tk()
# Defining the container size, width=400, height=240
root.geometry('1000x600')
# Title of the container
root.title('Love Calculator????')
# Function to calculate love percentage
# between the user ans partner
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 - How much is he/she into you')
heading.pack()
# Slot/input for the first name
slot1 = Label(root, text="Enter Your Name:")
slot1.pack()
name1 = Entry(root, border=15)
name1.pack()
# Slot/input for the partner name
slot2 = Label(root, text="Enter Your Partner Name:")
slot2.pack()
name2 = Entry(root, border=15)
name2.pack()
bt = Button(root,
text="Calculate", height=20,
width=30, 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()