-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (44 loc) · 1.09 KB
/
main.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
import random
import tkinter as tk
opem = open("Chinesechar.txt", encoding="utf8")
read = open.read()
list = []
for i in read:
if i != '\n':
list.append(i)
ran = random.randrange(0, 14127)
answer = list[ran]
print(answer)
text = "Guess the 中文字!!!"
chances = 6
running = True
while running:
def check():
global text
global chances
xe = x.get()
if xe == answer:
text = "you win"
else:
hm.Next()
chances -= 1
if chances == 0:
over = True
text = "you Lose, you word was: " + answer
running = False
else:
text = ("你有 " + str(chances) + " chances left")
label.configure(text=text)
x = tk.Entry()
xe = x.get()
label = tk.Label(text=text, font=25)
button = tk.Button(text="done", command=check)
label.pack()
x.pack()
button.pack()
import hangman as hm
window = tk.Tk()
window.withdraw()
window.geometry("800x800")
window.resizable(False, False)
window.mainloop()