-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bugtong.py
51 lines (35 loc) · 851 Bytes
/
Bugtong.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
from tkinter import *
import requests
import json
def getResult():
api = requests.get("https://api-pinoy-bugtong.vercel.app").text
return json.loads(api)
def check():
if entry.get() in res['s']:
label.config(text = "Nice")
else:
label.config(text = f"No the correct answer is {res['s']}")
button.config(text = "Click again to continue", command = restart)
def restart():
global res
res = getResult()
label.config(text = res['b'])
entry.delete(0, END)
button.config(text = "Verify Answer", command = check)
def start():
global base
global label
global entry
global button
base = Tk()
base.geometry("500x500")
base.title("Pinoy Bugtong")
label = Label()
label.pack()
entry = Entry()
entry.pack()
button = Button()
button.pack()
restart()
mainloop()
start()