【发布时间】:2015-12-23 23:48:48
【问题描述】:
这是我的代码,请记住我几天前拿起了 python,所以我的代码可能是错误的,等等。我正在尝试制作一个显示一些文本(测试版)的窗口,并将显示两个我想制作成按钮的小矩形。
import sys
import pygame
from pygame.locals import *
pygame.init()
size = width, height = 720, 480
speed = [2, 2]
black = (0,0,0)
blue = (0,0,255)
green = (0,255,0)
red = (255,0,0)
screen = pygame.display.set_mode(size)
screen.fill((blue))
pygame.display.set_caption("BETA::00.0.1")
clock = pygame.time.Clock()
def game_intro():
intro = True
while intro:
for event in pygame.event.get():
print(event)
if event.type == pygame.QUIT:
pygame.quit()
quit()
gameDisplay.fill(blue)
largeText = pygame.font.Font('freesansbold.ttf',115)
TextSurf, TextRect = text_objects("BETA", largeText)
TextRect.center = ((display_width/2),(display_height/2))
gameDisplay.blit(TextSurf, TextRect)
pygame.draw.rect(gameDisplay, green,(150,450,100,50))
pygame.draw.rect(gameDisplay, red,(550,450,100,50))
pygame.display.flip(screen)
pygame.display.update(screen)
clock.tick(15)
【问题讨论】: