-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearnWord.py
More file actions
95 lines (81 loc) · 1.62 KB
/
Copy pathlearnWord.py
File metadata and controls
95 lines (81 loc) · 1.62 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import tkinter
from tkinter import*
from tkinter import messagebox
import random
# you can add more words as per your requirement
answers = [
"python",
"java",
"vietnam",
"canada",
"india",
"america",
"london",
]
words = [
"nptoyh",
"avja",
"manteiv",
"cdanaa",
"aidin",
"aiearcm",
"odnlon",
]
num = random.randrange(0,len(words),1)
def default():
global words,answers,num
lbl.config(text = words[num])
def res():
global words,answers,num
num = random.randrange(0,len(words),1)
lbl.config(text = words[num])
e1.delete(0,END)
def checkans():
global words,answers,num
var = e1.get()
if var == answers[num]:
messagebox.showinfo("Success", "This is a correct answer")
res()
else:
messagebox.showerror("Error", "This is not Correct")
e1.delete(0, END)
root = tkinter.Tk()
root.geometry("350x400+400+300")
root.title("Check Word")
root.configure(background = "#000000")
lbl = Label(
root,
text = "Your here",
font = ("Verdana", 18),
bg = "#000000",
fg = "#FFFFFF",
)
lbl.pack(pady = 30,ipady=10,ipadx=10)
e1 = Entry(
root,
font = ("Verdana", 16),
textvariable = StringVar(),
)
e1.pack(ipady=5,ipadx=5)
btncheck = Button(
root,
text = "Check",
font = ("Comic sans ms", 16),
width = 16,
bg = "#4c4b4b",
fg = "#6ab04c",
command = checkans,
)
btncheck.pack(pady = 40)
btnreset = Button(
root,
text = "Reset",
font = ("Comic sans ms", 16),
width = 16,
bg = "#4c4b4b",
fg = "#EA425C",
command = res,
)
btnreset.pack()
default()
root.mainloop()