] } with open('bull_bear_days.json', 'w') as f: # with open('C://Users//faqui//Documents//github//y_Python//bull_bear_days.json', 'w') as f: json.dump(bull_bear_days, f) else: pass root = Tk() # 初始化Tk() root便是你布局的根节点了,以后的布局都在它之上 root.title("行者桑结") # 设置窗口标题 width = root.winfo_reqwidth() + 400 #窗口大小 height = root.winfo_reqheight() + 100 #窗口大小 x, y = (root.winfo_screenwidth() - width) / 2, (root.winfo_screenheight() - height) / 2 #root.attributes("-toolwindow", 1) #参数1,设置工具栏样式窗口。#参数1,没有最大化和最小化的按钮。 #root["background"] = "DarkBlue" root["bd"] = 4 root["relief"] = GROOVE #RAISED root.geometry('%dx%d+%d+%d' % (width, height, x, y)) #窗口位置居中,设置窗口大小 注意:是x 不是* root.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 #创建一个状态显示标签 info_status = Label(root, width=300,
from tkinter import * from tkinter import messagebox from tkinter.tix import Tk import sys import pygame from PIL.ImageTk import PhotoImage from pygame import mixer tk = Tk() w, h = tk.winfo_screenwidth(), tk.winfo_screenheight() tk.geometry("1400x800") # tk.wm_state('zoomed') our_image = PhotoImage(file='img/map.png') our_label = Label(tk) our_label.image = our_image our_label['image'] = our_label.image our_label.place(x=50, y=0) def destroy(): # Досрочный Game Over if messagebox.askokcancel("Quit", "Do you want to quit?"): sys.exit() b1 = Button(tk, text="Start", command=tk.destroy, fg='Navy', font=("Georgia", 16, "bold")) b1.place(x=1030, y=500, width=70, height=40) b1["bg"] = "SpringGreen"