def todo_test_flip(self):
# __doc__ (as of 2008-08-02) for pygame.display.flip:
# pygame.display.flip(): return None
# update the full display Surface to the screen
#
# This will update the contents of the entire display. If your display
# mode is using the flags pygame.HWSURFACE and pygame.DOUBLEBUF, this
# will wait for a vertical retrace and swap the surfaces. If you are
# using a different type of display mode, it will simply update the
# entire contents of the surface.
#
# When using an pygame.OPENGL display mode this will perform a gl buffer swap.
self.fail()
python类DOUBLEBUF的实例源码
def todo_test_mode_ok(self):
# __doc__ (as of 2008-08-02) for pygame.display.mode_ok:
# pygame.display.mode_ok(size, flags=0, depth=0): return depth
# pick the best color depth for a display mode
#
# This function uses the same arguments as pygame.display.set_mode().
# It is used to depermine if a requested display mode is available. It
# will return 0 if the display mode cannot be set. Otherwise it will
# return a pixel depth that best matches the display asked for.
#
# Usually the depth argument is not passed, but some platforms can
# support multiple display depths. If passed it will hint to which
# depth is a better match.
#
# The most useful flags to pass will be pygame.HWSURFACE,
# pygame.DOUBLEBUF, and maybe pygame.FULLSCREEN. The function will
# return 0 if these display flags cannot be set.
#
self.fail()
def set_resolution(self):
self.screen = pygame.display.set_mode((self.width+5, self.height), pygame.DOUBLEBUF)
if self.backgroundimage is None:
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
else:
self.background = pygame.image.load(self.backgroundimage)
self.background = pygame.transform.scale(self.background, self.screen.get_size())
self.background.convert()
for x in range(10): # backgroundimage0 - backgroundimage9
filename = self.backgroundimage[:-4] + str(x) + self.backgroundimage[-4:]
try:
image = pygame.image.load(filename)
image = pygame.transform.scale(image, self.screen.get_size())
image.convert()
self.backgrounds.append(image)
except:
print("no backgroundimage found for {}".format(filename))
self.backgrounds.append(self.background)
self.background = self.backgrounds[1]
def todo_test_flip(self):
# __doc__ (as of 2008-08-02) for pygame.display.flip:
# pygame.display.flip(): return None
# update the full display Surface to the screen
#
# This will update the contents of the entire display. If your display
# mode is using the flags pygame.HWSURFACE and pygame.DOUBLEBUF, this
# will wait for a vertical retrace and swap the surfaces. If you are
# using a different type of display mode, it will simply update the
# entire contents of the surface.
#
# When using an pygame.OPENGL display mode this will perform a gl buffer swap.
self.fail()
def todo_test_mode_ok(self):
# __doc__ (as of 2008-08-02) for pygame.display.mode_ok:
# pygame.display.mode_ok(size, flags=0, depth=0): return depth
# pick the best color depth for a display mode
#
# This function uses the same arguments as pygame.display.set_mode().
# It is used to depermine if a requested display mode is available. It
# will return 0 if the display mode cannot be set. Otherwise it will
# return a pixel depth that best matches the display asked for.
#
# Usually the depth argument is not passed, but some platforms can
# support multiple display depths. If passed it will hint to which
# depth is a better match.
#
# The most useful flags to pass will be pygame.HWSURFACE,
# pygame.DOUBLEBUF, and maybe pygame.FULLSCREEN. The function will
# return 0 if these display flags cannot be set.
#
self.fail()
def __init__(self, width=1050, height=800, fps=30, grid=50):
"""Initialize pygame, window, background, font,..."""
pygame.init()
pygame.display.set_caption("Press ESC to quit")
PygView.width = width # make global readable
PygView.height = height
PygView.grid = grid
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
#self.font = pygame.font.SysFont('mono', 24, bold=True)
self.joysticks = []
for x in range(pygame.joystick.get_count()):
j = pygame.joystick.Joystick(x)
j.init()
self.joysticks.append(j)
self.loadresources() # loadresources calls paintgrid
#pygame.joystick.init()
#self.joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
def __init__(self, resource_directory):
self.setup_logging(resource_directory)
logger.info('Starting Wargame v{0}'.format(VERSION))
system_checks()
self.screen = pygame.display.set_mode((640, 480), pygame.DOUBLEBUF)
pygame.display.set_caption('HexGame')
Resources.load_resources(resource_directory, self.screen)
self.clock = pygame.time.Clock()
self.scenes = {}
self.current_scene = None
self.last_tick = 0
def __init__(self):
self.runtime_id = 0
self._canvas = None
self._background = None
self._photo_space = None
self.target_dir = None
self.font = None
self._init_camera()
self.photos = []
self.printer = backends.acquire_backend("output", "line_printer", self.config)
self._init_gpio()
self._get_last_runtime_id()
self.get_current_photo_directory()
pygame.init()
self.clock = pygame.time.Clock()
self.limit_cpu_usage()
display_mode = pygame.HWSURFACE | pygame.DOUBLEBUF | pygame.FULLSCREEN
self._canvas = pygame.display.set_mode((0, 0), display_mode)
self.screen_width = pygame.display.Info().current_w
self.screen_height = pygame.display.Info().current_h
self._background = self.fill_background()
self._photo_space = self.fill_photo_space()
self._running = True
self.font = pygame.font.Font(self.config.get('font_filename'), self.config.getint('font_size'))
pygame.mouse.set_visible(False)
def __initialize_display(self):
self.resolution_key = self.settings['screen']['resolution']
resolution = self.settings['valid_resolutions'][self.resolution_key]
self.resolution = (resolution['width'], resolution['height'])
if self.settings['screen']['fullscreen']:
self.screen = pygame.display.set_mode(self.resolution, pygame.FULLSCREEN | pygame.DOUBLEBUF)
else:
self.screen = pygame.display.set_mode(self.resolution, pygame.DOUBLEBUF)
pygame.display.set_caption(self.settings['title'])
def __init__(self, width=640, height=400, fps=30, filename = "level1.txt", tilew = 20, tileh = 20):
"""Initialize pygame, window, background, font,...
default arguments
"""
pygame.init()
pygame.display.set_caption("--- MAP-VIEWER ---")
PygView.width = width # make global readable
PygView.height = height
self.filename = filename
self.tilew = tilew
self.tileh = tileh
self.lines = 32
self.chars = 64
self.tiles = []
print(self.lines, self.chars)
print(self.tiles)
PygView.width = self.chars * self.tilew
PygView.height = self.lines * self.tileh
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
#self.clock = pygame.time.Clock()
#self.fps = fps
#self.playtime = 0.0
#self.font = pygame.font.SysFont('mono', 24, bold=True)
self.paint()
def __init__(self, width=640, height=400, fps=30):
"""Initialize pygame, window, background, font,..."""
pygame.init()
pygame.display.set_caption("Press ESC to quit")
PygView.width = width # make global readable
PygView.height = height
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.loadresources()
self.background = pygame.Surface(PygView.images[0].get_size())
self.background.blit(PygView.images[0], (0,0))
#self.background = pygame.Surface(self.screen.get_size()).convert()
#self.background.fill((255,255,255)) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
#self.loadresources()
self.mapzoom = 5
dx = Vec2d(20,15)
print("dx",dx)
ex = Vec2d(7,0)
print("ex", ex)
print("dx + ex:", dx+ex) # vektor addition
print("dx * 2", dx * 2) # vektor multiplizieren
print("x, y von dx", dx.x, dx.y) # attribute vom Vektor
print("senkrechte zu dx", dx.perpendicular())
print("distanz zw. dx und ex", dx.get_distance(ex))
def resize(width, height):
length = min(width, height)
offset = int( math.fabs(width - height) / 2)
# Ugly AF
pg.display.set_mode((width, height), pg.DOUBLEBUF | pg.RESIZABLE | pg.OPENGL)
if width < height:
gl.glViewport(0, offset, length, length)
else:
gl.glViewport(offset, 0, length, length)
def setFullScreen(mode):
"If mode is True, turns on full screen, otherwise, turns it off"
global screen
if mode:
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN|pygame.HWSURFACE|pygame.DOUBLEBUF)
else:
screen = pygame.display.set_mode(SCREEN_SIZE)
def __init__(self):
self._running = True
self.background = pygame.image.load('background.png')
self.hero = pygame.image.load('hero.png')
self.x = 0
self.y = 0
pygame.init()
self._display_surf = pygame.display.set_mode((640, 480), pygame.HWSURFACE | pygame.DOUBLEBUF)
def get_screen(xwin=False):
"""Initializes a new pygame screen using the framebuffer"""
# Based on "Python GUI in Linux frame buffer"
# http://www.karoltomala.com/blog/?p=679
disp_no = os.getenv("DISPLAY")
if disp_no:
print "I'm running under X display = {0}".format(disp_no)
# Make sure that SDL_VIDEODRIVER is set
if xwin:
driver = 'x11'
else:
driver = 'directfb' # alternatives: 'fbcon', 'svgalib'
if not os.getenv('SDL_VIDEODRIVER'):
os.putenv('SDL_VIDEODRIVER', driver)
try:
pygame.display.init()
except pygame.error:
raise Exception('Display init failed with driver: {0}'.format(driver))
if xwin:
size = (320, 200)
options = 0
else:
# fullscreen
info = pygame.display.Info()
size = (info.current_w, info.current_h)
print "Framebuffer size: %d x %d" % (size[0], size[1])
options = pygame.FULLSCREEN | pygame.DOUBLEBUF
screen = pygame.display.set_mode(size, options)
# Clear the screen to start
screen.fill((0, 0, 0))
pygame.mouse.set_visible(False)
# Render the screen
pygame.display.update()
return screen
def __init__(self, dimensions, fullscreen = False, soundrenderer="pyaudio",
loop=False):
""" Constructor.
Parameters
----------
dimensions : tuple (width, height)
The dimension of the window in which the video should be shown. Aspect
ratio is maintained.
fullscreen : bool, optional
Indicates whether the video should be displayed in fullscreen.
soundrenderer : {'pyaudio','pygame'}
Designates which sound backend should render the sound.
"""
pygame.init()
(windowWidth, windowHeight) = dimensions
flags = pygame.DOUBLEBUF|pygame.OPENGL|pygame.HWSURFACE
self.fullscreen = fullscreen
if fullscreen:
flags = flags | pygame.FULLSCREEN
pygame.display.set_mode((windowWidth,windowHeight), flags)
self.windowSize = (windowWidth, windowHeight)
self.soundrenderer=soundrenderer
self.loop = loop
self.texUpdated = False
self.__initGL()
self.decoder = Decoder(
videorenderfunc=self.__texUpdate,
)
self.texture_locked = False
def __init__(self, width, height):
self.width = width
self.height = height
pygame.init()
self.window = pygame.display.set_mode( (self.width, self.height), pygame.DOUBLEBUF, 24 )
pygame.display.set_caption("PLE ViZDoom")
def set_up_pygame():
bits = 16
pygame.mixer.pre_init(44100, -bits, 2)
pygame.init()
_display_surf = pygame.display.set_mode(size, pygame.HWSURFACE | pygame.DOUBLEBUF)
def __init__(self, width=640, height=400, fps=30, grid=50):
"""Initialize pygame, window, background, font,..."""
pygame.init()
pygame.display.set_caption("Press ESC to quit")
PygView.width = width # make global readable
PygView.height = height
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
self.grid = grid
#self.font = pygame.font.SysFont('mono', 24, bold=True)
self.loadresources()
def __init__(self, text, width=640, height=400, fps=30, color=(0,0,255)):
"""Initialize pygame, window, background, font,...
default arguments
"""
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.init()
#jump = pygame.mixer.Sound(os.path.join('data','jump.wav')) #load sound
#self.sound1 = pygame.mixer.Sound(os.path.join('data','Pickup_Coin.wav'))
#self.sound2 = pygame.mixer.Sound(os.path.join('data','Jump.wav'))
#self.sound3 = pygame.mixer.Sound(os.path.join('data','mix.wav'))
pygame.display.set_caption("Press ESC to quit, UP / DOWN to scroll")
self.text = text
self.color = color
self.lines = text.split("\n")
self.width = width
self.height = height
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
self.offset_y = self.height - 10
self.x = 100
self.dy = 50
self.font = pygame.font.SysFont('mono', 24, bold=True)
def set_resolution(self):
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
def _init_gui(self):
pygame.init()
self._build_targets()
if GUI_MODE:
self._screen = pygame.display.set_mode(self.size, pygame.HWSURFACE | pygame.DOUBLEBUF)
self._running = True
def main():
""" Main function for the game. """
# Get Pygame ready
pygame.init()
# Set the width and height of the screen [width,height]
size = (640,480)
video_flags = pygame.OPENGL | pygame.DOUBLEBUF
screen = pygame.display.set_mode(size, video_flags)
# Create an OpenGL viewport
resize_gl_scene(size)
init_gl()
# These are for calculating FPS
frames = 0
ticks = pygame.time.get_ticks()
done = False
while not done:
event = pygame.event.poll()
if event.type == pygame.QUIT:
done = True
draw_gl_scene()
pygame.display.flip()
frames = frames + 1
total_ticks = pygame.time.get_ticks() - ticks
print("Average of {:.1f} fps".format((frames * 1000) / total_ticks))
pygame.quit()
def __init__(self, drivers=DEFAULT_DRIVERS, size=DEFAULT_SIZE, screen_type=DEFAULT_SCREEN, borders=(5, 5),
border_width=3, line_color=(255, 255, 255), font='freesans', font_color=(255, 255, 255),
icons=ICON_DICTIONARY):
"""DisplayDriver class is the class that build the base display for use in the weather
app. Argument descriptions: drivers is a tuple of strings with available SDL_VIDEODRIVER
environmental varaibles; size is a tuple of two integers describing the x, y size of the
screen; screen_type is a string value that corresponds to the pygame constants for
dispay.set_mode
"""
formats = {'no_frame': pygame.NOFRAME, 'full_screen': pygame.FULLSCREEN, 'double_buff': pygame.DOUBLEBUF,
'hw_surface': pygame.HWSURFACE, 'open_GL': pygame.OPENGL, 'resizable': pygame.RESIZABLE}
self._system_data = SystemData()
self._display_instance = None
self._drivers = drivers
self._size = size
self._borders = borders
self._border_width = border_width
self._line_color = line_color
self._font = font
self._font_color = font_color
self._format = formats[screen_type]
self._icons = icons
self._base_dir = os.getcwd() + ICON_BASE_DIR
self._scale_icons = True
self._xmax = self._size[0] - self._borders[0]
self._ymax = self._size[1] - self._borders[1]
self._av = 1
self._av_time = 1
self._screen = None
self._blits = []
def todo_test_set_mode(self):
# __doc__ (as of 2008-08-02) for pygame.display.set_mode:
# pygame.display.set_mode(resolution=(0,0), flags=0, depth=0): return Surface
# initialize a window or screen for display
#
# This function will create a display Surface. The arguments passed in
# are requests for a display type. The actual created display will be
# the best possible match supported by the system.
#
# The resolution argument is a pair of numbers representing the width
# and height. The flags argument is a collection of additional
# options. The depth argument represents the number of bits to use
# for color.
#
# The Surface that gets returned can be drawn to like a regular
# Surface but changes will eventually be seen on the monitor.
#
# If no resolution is passed or is set to (0, 0) and pygame uses SDL
# version 1.2.10 or above, the created Surface will have the same size
# as the current screen resolution. If only the width or height are
# set to 0, the Surface will have the same width or height as the
# screen resolution. Using a SDL version prior to 1.2.10 will raise an
# exception.
#
# It is usually best to not pass the depth argument. It will default
# to the best and fastest color depth for the system. If your game
# requires a specific color format you can control the depth with this
# argument. Pygame will emulate an unavailable color depth which can
# be slow.
#
# When requesting fullscreen display modes, sometimes an exact match
# for the requested resolution cannot be made. In these situations
# pygame will select the closest compatable match. The returned
# surface will still always match the requested resolution.
#
# The flags argument controls which type of display you want. There
# are several to choose from, and you can even combine multiple types
# using the bitwise or operator, (the pipe "|" character). If you pass
# 0 or no flags argument it will default to a software driven window.
# Here are the display flags you will want to choose from:
#
# 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
self.fail()
def init():
"Ininitializes a new pygame screen using the framebuffer"
# Based on "Python GUI in Linux frame buffer"
# http://www.karoltomala.com/blog/?p=679
disp_no = os.getenv("DISPLAY")
if disp_no:
print "I'm running under X display = {0}".format(disp_no)
# Check which frame buffer drivers are available
# Start with fbcon since directfb hangs with composite output
drivers = ['fbcon', 'directfb', 'svgalib']
#drivers = ['directfb', 'svgalib']
#drivers = ['fbcon']
found = False
for driver in drivers:
# Make sure that SDL_VIDEODRIVER is set
if not os.getenv('SDL_VIDEODRIVER'):
os.putenv('SDL_VIDEODRIVER', driver)
try:
print 'Driver: {0} '.format(driver)
pygame.display.init()
except pygame.error:
print 'Driver: {0} failed.'.format(driver)
continue
found = True
break
if not found:
raise Exception('No suitable video driver found!')
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Framebuffer size: %d x %d" % (size[0], size[1])
pygame.mouse.set_visible(False)
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.DOUBLEBUF | pygame.HWSURFACE)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.DOUBLEBUF)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.HWSURFACE)
# Clear the screen to start
screen.fill((255, 105, 180))
# Initialise font support
pygame.font.init()
# Render the screen
pygame.display.update()
return screen
def init():
"Ininitializes a new pygame screen using the framebuffer"
# Based on "Python GUI in Linux frame buffer"
# http://www.karoltomala.com/blog/?p=679
disp_no = os.getenv("DISPLAY")
if disp_no:
print "I'm running under X display = {0}".format(disp_no)
# Check which frame buffer drivers are available
# Start with fbcon since directfb hangs with composite output
#drivers = ['fbcon', 'directfb', 'svgalib']
#drivers = ['directfb', 'svgalib']
drivers = ['vesafbdf']
found = False
for driver in drivers:
# Make sure that SDL_VIDEODRIVER is set
if not os.getenv('SDL_VIDEODRIVER'):
os.putenv('SDL_VIDEODRIVER', driver)
try:
print 'Driver: {0} '.format(driver)
pygame.display.init()
except pygame.error:
print 'Driver: {0} failed.'.format(driver)
exit()
continue
found = True
break
if not found:
raise Exception('No suitable video driver found!')
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
print "Framebuffer size: %d x %d" % (size[0], size[1])
pygame.mouse.set_visible(False)
screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.DOUBLEBUF | pygame.HWSURFACE)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.DOUBLEBUF)
#screen = pygame.display.set_mode(size, pygame.FULLSCREEN | pygame.HWSURFACE)
# Clear the screen to start
screen.fill((255, 105, 180))
# Initialise font support
pygame.font.init()
# Render the screen
pygame.display.update()
return screen
def __init__(self, text, width=640, height=400, fps=30, textcolor=(0,0,255),
bgcolor=(255,255,255), font=('mono', 24, True), new_init=True, bg_filename=None):
"""Initialize pygame, window, background, font,...
default arguments
"""
#pygame.mixer.pre_init(44100, -16, 2, 2048)
if new_init:
pygame.init()
#jump = pygame.mixer.Sound(os.path.join('data','jump.wav')) #load sound
#self.sound1 = pygame.mixer.Sound(os.path.join('data','Pickup_Coin.wav'))
#self.sound2 = pygame.mixer.Sound(os.path.join('data','Jump.wav'))
#self.sound3 = pygame.mixer.Sound(os.path.join('data','mix.wav'))
pygame.display.set_caption("Press ESC to quit, curosr keys / PgUp, PgDown to scroll")
self.text = text
self.bgcolor = bgcolor
self.textcolor = textcolor
self.lines = text.split("\n")
self.width = width
self.height = height
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
if bg_filename is None:
self.background.fill(self.bgcolor) # fill background white
else:
try:
print("i try to load:", bg_filename)
self.background = pygame.image.load(bg_filename)
self.background = pygame.transform.scale(self.background, (self.width, self.height))
except:
print("exception while processing:", bg_filename)
self.background.fill(self.bgcolor) # fill background white
self.clock = pygame.time.Clock()
self.fps = fps
self.playtime = 0.0
self.offset_y = self.height - 10
self.x = 100
self.dy = 50
self.text_height = len(self.lines) * self.dy
self.bold = font[2]
self.font = pygame.font.SysFont(font[0], font[1], self.bold)
def __init__(self, width=640, height=400, fps=30, filename = "level1.txt", tilew = 20, tileh = 20):
"""Initialize pygame, window, background, font,...
default arguments
"""
pygame.init()
pygame.display.set_caption("--- MAP-VIEWER ---")
PygView.width = width # make global readable
PygView.height = height
self.filename = filename
self.tilew = tilew
self.tileh = tileh
self.lines = []
try:
lines = 0
chars = 0
with open(self.filename) as myfile:
for line in myfile:
self.lines.append(line[:-1])
lines += 1
chars = len(line) - 1
except:
print("-- fileReadingError --")
print(lines, chars)
PygView.width = chars * self.tilew
PygView.height = lines * self.tileh
self.colourdict = {3:(1, 0, 122),
4:(93, 92, 244),
5:(145, 144, 245),
6:(246, 252, 84),
7:(226, 144, 36),
8:(127, 127, 127)}
self.screen = pygame.display.set_mode((self.width, self.height), pygame.DOUBLEBUF)
self.background = pygame.Surface(self.screen.get_size()).convert()
self.background.fill((255,255,255)) # fill background white
for line in range(lines):
for char in range(chars):
pygame.draw.rect(self.background, self.colourdict[int(self.lines[line][char])],
(self.tilew * char, self.tileh * line, tilew, tileh))
#self.clock = pygame.time.Clock()
#self.fps = fps
#self.playtime = 0.0
#self.font = pygame.font.SysFont('mono', 24, bold=True)
self.paint()
def todo_test_set_mode(self):
# __doc__ (as of 2008-08-02) for pygame.display.set_mode:
# pygame.display.set_mode(resolution=(0,0), flags=0, depth=0): return Surface
# initialize a window or screen for display
#
# This function will create a display Surface. The arguments passed in
# are requests for a display type. The actual created display will be
# the best possible match supported by the system.
#
# The resolution argument is a pair of numbers representing the width
# and height. The flags argument is a collection of additional
# options. The depth argument represents the number of bits to use
# for color.
#
# The Surface that gets returned can be drawn to like a regular
# Surface but changes will eventually be seen on the monitor.
#
# If no resolution is passed or is set to (0, 0) and pygame uses SDL
# version 1.2.10 or above, the created Surface will have the same size
# as the current screen resolution. If only the width or height are
# set to 0, the Surface will have the same width or height as the
# screen resolution. Using a SDL version prior to 1.2.10 will raise an
# exception.
#
# It is usually best to not pass the depth argument. It will default
# to the best and fastest color depth for the system. If your game
# requires a specific color format you can control the depth with this
# argument. Pygame will emulate an unavailable color depth which can
# be slow.
#
# When requesting fullscreen display modes, sometimes an exact match
# for the requested resolution cannot be made. In these situations
# pygame will select the closest compatable match. The returned
# surface will still always match the requested resolution.
#
# The flags argument controls which type of display you want. There
# are several to choose from, and you can even combine multiple types
# using the bitwise or operator, (the pipe "|" character). If you pass
# 0 or no flags argument it will default to a software driven window.
# Here are the display flags you will want to choose from:
#
# 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
self.fail()