# -*- coding: <utf-8> -*- #
import random
import tkinter as tk
from tkinter import messagebox
import time
from matplotlib.widgets import EllipseSelector
window = tk.Tk()
window.title('勇士游戏')
window.geometry('300x250')
window.resizable(False, False)
queding = False
TianShu = 1
GongJi = random.randint(25, 30)
XueLiang = 100
JiE = 100
SuDu = 10
FangYu = 10
xinxi = '''
血量: {}
饥饿度: {}
速度: {}
防御: {}
'''.format(XueLiang, JiE, SuDu, FangYu)
v = tk.IntVar()
def TuiChu():
tuichu = messagebox.askokcancel(title='退出', message='你确定要退出游戏吗?')
if tuichu:
window.quit()
def ZhuCaiDan():
zhucaidan = messagebox.askokcancel(title='返回', message='你确定要返回主菜单吗?')
if zhucaidan:
pass
def QueDing():
global QueDing
if QueDing:
QueDing = True
print('True')
else:
QueDing = False
print('False')
def ChuFa():
pass
def ZhuangBei():
pass
def ChaKanZhuangBei():
pass
def WuPin():
pass
def ShiYong():
pass
def YiTian():
pass
l = tk.Label(window, text='今天是第 {} 天,你要:'.format(TianShu), font=1)
l.place(x=80, y=5)
XinXi = tk.Label(window, text=xinxi, bg='yellow', fg='black', font=15, width=15, height=8)
XinXi.place(x=150, y=50)
r1 = tk.Radiobutton(window, text='1. 出发', variable=v, value=1, command=ChuFa)
r1.place(x=20, y=40)
r2 = tk.Radiobutton(window, text='2. 装备物品', variable=v, value=2, command=ZhuangBei)
r2.place(x=20, y=65)
r3 = tk.Radiobutton(window, text='3. 查看装备', variable=v, value=3, command=ChaKanZhuangBei)
r3.place(x=20, y=90)
r4 = tk.Radiobutton(window, text='4. 查看物品', variable=v, value=4, command=WuPin)
r4.place(x=20, y=115)
r5 = tk.Radiobutton(window, text='5. 吃东西', variable=v, value=5, command=ShiYong)
r5.place(x=20, y=140)
r6 = tk.Radiobutton(window, text='6. 过了这一天~', variable=v, value=6, command=YiTian)
r6.place(x=20, y=165)
B = tk.Button(window, text='确定', bg='gray', width=25, height=2, command=QueDing)
B.place(x=55, y=195)
if QueDing == True:
if v.get() == 1:
print("haha")
m = tk.Menu(window)
f = tk.Menu(m, tearoff=0)
m.add_cascade(label='返回', menu=f)
f.add_command(label='返回主菜单', command=ZhuCaiDan)
window.config(menu=m)
b = tk.Button(window, text='退出游戏', bg='black', fg='white', width=7, height=1, command=TuiChu)
b.place(x=2, y=2)
window.mainloop()