马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 mr.wyu 于 2021-9-4 09:25 编辑
如下代码:在按下F11后显示一个缩在左上角不能移动的窗口,而且没有边框 没有控制按钮!!!!正常情况的话,按下F11 会在屏幕中间 出现一个窗口游戏端!!!import pygame
import sys
from pygame.locals import *
pygame.init()
size = width, height = 600, 600
speed = [-2, 1]
bg = (255, 255, 255)
clock = pygame.time.Clock()
screen = pygame.display.set_mode(size)
pygame.display.set_caption('乱跑的小火箭')
turtle = pygame.image.load('images/ship.bmp')
position = turtle.get_rect()
fullscreen = False
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
if event.type == KEYDOWN:
if event.key == K_q:
sys.exit()
if event.key == K_F11:
fullscreen = not fullscreen
if fullscreen:
screen = pygame.display.set_mode(pygame.display.list_modes()[0], FULLSCREEN)
else:
screen = pygame.display.set_mode(size)
position = position.move(speed)
if position.left < 0 or position.right > width:
turtle = pygame.transform.flip(turtle, True, False)
speed[0] = -speed[0]
if position.top < 0 or position.bottom > height:
speed[1] = -speed[1]
screen.fill(bg)
screen.blit(turtle, position)
pygame.display.flip()
pygame.time.delay(10)
|