源代码如下:
import pygame
import sys
from random import choice
from pygame.locals import *
RED = (255, 0, 0)
GREEN = (0, 255, 0 )
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 100, 0)
PURPLE = (100, 0, 255)
def get_words():
f = open(“E://word.txt”)
temp = f.readlines()
words = []
for word in temp:
words.append(word.strip())
return words
def draw_gallows(screen):
pygame.draw.r