import tkinter as tk
from tkinter import ttk
import pygame
import random
root = tk.Tk()
root.title('选择你的难度')
options = {"简单": 10, "中等": 24, "困难": 60}
choice = tk.StringVar()
combobox = ttk.Combobox(root, textvariable=choice)
combobox['values'] = list(options.keys())
combobox.pack()
root.geometry("500x100+700+400")
def set_framerate_and_start():
framerate = options[choice.get()]
pygame.init()
# 游戏窗口大小
screen_width = 800
screen_height = 600
# 颜色定义(R,G,B)
black = (0, 0, 0)
white = (255, 255, 255)
red = (213, 50, 80)
green = (0, 255, 0)
blue = (50, 153, 213)
game_display = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('引力透镜-贪吃蛇')
clock = pygame.time.Clock()
font_style = pygame.font.SysFont(None, 36
python贪吃蛇包含难度选择(tk and pygame)
最新推荐文章于 2024-06-04 13:27:01 发布