''' pygame.FULLSCREEN create a fullscreen display pygame.DOUBLEBUF recommended for HWSURFACE or OPENGL pygame.HWSURFACE hardware accelerated, only in FULLSCREEN pygame.OPENGL create an opengl renderable display pygame.RESIZABLE display window should be sizeable pygame.NOFRAME display window will have no border or controls '''
#pygame fullscreen
import os, pygame
from pygame.locals import *
from sys import exit
'''
pygame.display.set_mode():
pygame.FULLSCREEN create a fullscreen display
pygame.DOUBLEBUF recommended for HWSURFACE or OPENGL
pygame.HWSURFACE hardware accelerated, only in FULLSCREEN
pygame.OPENGL create an opengl renderable display
pygame.RESIZABLE display window should be sizeable
pygame.NOFRAME display window will have no border or controls
'''
__author__ = {'name' : 'Hongten',
'mail' : 'hongtenzone@foxmail.com',
'Version' : '1.0'}
BG_IMAGE = 'C://py//bg.png'
SCREEN_DEFAULT_SIZE = (500, 500)
pygame.init()
#create the image path
bg_path = os.path.join('data', BG_IMAGE)
if not os.path.exists(bg_path):
print('The BackGround Image does not exist!')
screen = pygame.display.set_mode(SCREEN_DEFAULT_SIZE, 0, 32)
bg = pygame.image.load(bg_path).convert()
#full screen flag
full_screen = False
while 1:
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type == KEYDOWN:
#when press the 'f',then change the screen display model
if event.key == K_f:
full_screen = not full_screen
if full_screen:
print('Open the Fullscreen model!')
else:
print('Open the Default model!')
if full_screen:
#full screen display model
screen = pygame.display.set_mode(SCREEN_DEFAULT_SIZE, FULLSCREEN, 32)
else:
#default model
screen = pygame.display.set_mode(SCREEN_DEFAULT_SIZE, 0, 32)
screen.blit(bg, (0, 0))
pygame.display.update()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有