python类FULLSCREEN的实例源码

display_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def todo_test_list_modes(self):

        # __doc__ (as of 2008-08-02) for pygame.display.list_modes:

          # pygame.display.list_modes(depth=0, flags=pygame.FULLSCREEN): return list
          # get list of available fullscreen modes
          # 
          # This function returns a list of possible dimensions for a specified
          # color depth. The return value will be an empty list if no display
          # modes are available with the given arguments. A return value of -1
          # means that any requested resolution should work (this is likely the
          # case for windowed modes). Mode sizes are sorted from biggest to
          # smallest.
          # 
          # If depth is 0, SDL will choose the current/best color depth for the
          # display. The flags defaults to pygame.FULLSCREEN, but you may need
          # to add additional flags for specific fullscreen modes.
          # 

        self.fail()
display_test.py 文件源码 项目:Projects 作者: it2school 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
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()
gui.py 文件源码 项目:photobooth 作者: LoiX07 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, name, size, fullscreen=True):
        # Call init routines
        pygame.init()

        # Window name
        pygame.display.set_caption(name)

        # Hide mouse cursor
        pygame.mouse.set_visible(False)

        # Store screen and size
        self.size = size
        if fullscreen:
            self.screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
        else:
            self.screen = pygame.display.set_mode(size)
            # windowed mode is for debug so we also show the cursor
            pygame.mouse.set_visible(True)

        # Clear screen
        self.clear()
        self.apply()
ui.py 文件源码 项目:rpi_lcars 作者: tobykurien 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, screen, resolution=(800,480), 
                 ui_placement_mode=False, fps=60, dev_mode=False,
                 audio=(22050, -8, 1, 1024)):
        # init system
        pygame.mixer.init(audio[0], audio[1], audio[2], audio[3])
        pygame.font.init()
        pygame.init()

        self.screenSurface = pygame.display.set_mode(resolution) #, pygame.FULLSCREEN)
        self.fpsClock = pygame.time.Clock()
        self.fps = fps
        pygame.display.set_caption("LCARS")
        if not dev_mode: pygame.mouse.set_visible(False)

        # set up screen elements
        self.all_sprites = pygame.sprite.LayeredDirty()
        self.all_sprites.UI_PLACEMENT_MODE = ui_placement_mode

        self.screen = screen
        self.screen.setup(self.all_sprites)
        self.running = True
clock.py 文件源码 项目:pygame-flipclock 作者: prehensile 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def init_pygame( self, native_width=480, native_height=272 ):

        self.background_colour = ( 255,255,255 )

        pygame.init()

        display_info = pygame.display.Info()
        w = display_info.current_w
        h = display_info.current_h
        self.window_size=(w,h)

        if (w <= native_width) or (h <= native_height):
            self.window = pygame.display.set_mode( self.window_size, pygame.FULLSCREEN )  
        else:
            self.window = pygame.display.set_mode( (native_width, native_height) )

        self.surface = pygame.display.get_surface()

        pygame.mouse.set_visible( False )

        self.clock = pygame.time.Clock()
eduactiv8.py 文件源码 项目:eduActiv8 作者: imiolek-ireneusz 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def fullscreen_toggle(self, info):
        """toggle between fullscreen and windowed version with CTRL + F
        current activity will be reset"""
        self.redraw_needed = [True, True, True]
        if self.config.fullscreen is True:
            self.config.fullscreen = False
            self.size = self.wn_size[:]
            self.screen = pygame.display.set_mode(self.size, pygame.RESIZABLE)
            self.fs_rescale(info)
        else:
            self.config.fullscreen = True
            self.size = self.fs_size[:]
            self.screen = pygame.display.set_mode(self.size, pygame.FULLSCREEN)
            self.fs_rescale(info)

            pygame.display.flip()
pygame_functions.py 文件源码 项目:Pygame_Functions 作者: StevePaget 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def screenSize(sizex, sizey, xpos=None, ypos=None, fullscreen=False):
    global bgcolor
    global screen
    global bgSurface
    if xpos != None and ypos != None:
        os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % (xpos, ypos + 50)
    else:
        windowInfo = pygame.display.Info()
        monitorWidth = windowInfo.current_w
        monitorHeight = windowInfo.current_h
        os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % ((monitorWidth - sizex) / 2, (monitorHeight - sizey) / 2)
    if fullscreen:
        screen = pygame.display.set_mode([sizex, sizey], pygame.FULLSCREEN)
    else:
        screen = pygame.display.set_mode([sizex, sizey])
    screen.fill(bgcolor)
    pygame.display.set_caption("Graphics Window")
    bgSurface = screen.copy()
    pygame.display.update()
pygame_functions.py 文件源码 项目:Pygame_Functions 作者: StevePaget 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def screenSize(sizex, sizey, xpos=None, ypos=None, fullscreen=False):
    global bgcolor
    global screen
    global bgSurface
    if xpos != None and ypos != None:
        os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % (xpos, ypos + 50)
    else:
        windowInfo = pygame.display.Info()
        monitorWidth = windowInfo.current_w
        monitorHeight = windowInfo.current_h
        os.environ['SDL_VIDEO_WINDOW_POS'] = "%d, %d" % ((monitorWidth - sizex) / 2, (monitorHeight - sizey) / 2)
    if fullscreen:
        screen = pygame.display.set_mode([sizex, sizey], pygame.FULLSCREEN)
    else:
        screen = pygame.display.set_mode([sizex, sizey])
    screen.fill(bgcolor)
    pygame.display.set_caption("Graphics Window")
    bgSurface = screen.copy()
    pygame.display.update()
display_test.py 文件源码 项目:AIFun 作者: Plottel 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def todo_test_list_modes(self):

        # __doc__ (as of 2008-08-02) for pygame.display.list_modes:

          # pygame.display.list_modes(depth=0, flags=pygame.FULLSCREEN): return list
          # get list of available fullscreen modes
          # 
          # This function returns a list of possible dimensions for a specified
          # color depth. The return value will be an empty list if no display
          # modes are available with the given arguments. A return value of -1
          # means that any requested resolution should work (this is likely the
          # case for windowed modes). Mode sizes are sorted from biggest to
          # smallest.
          # 
          # If depth is 0, SDL will choose the current/best color depth for the
          # display. The flags defaults to pygame.FULLSCREEN, but you may need
          # to add additional flags for specific fullscreen modes.
          # 

        self.fail()
display_test.py 文件源码 项目:AIFun 作者: Plottel 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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()
graph.py 文件源码 项目:SerialGraphicator 作者: newtonis 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def Refresh(self):
        self.screen.fill((255,255,255))
        self.App.Refresh()
        pygame.display.update()
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if pygame.key.get_pressed()[pygame.K_LCTRL] and pygame.key.get_pressed()[pygame.K_s] and not self.flag:
            self.flag = True
            name =  str( time.time() )+ ".png"
            pygame.image.save(self.screen , str( time.time() )+ ".png")
            print "screenshot ",name," saved"

        if pygame.key.get_pressed()[ pygame.K_F11 ] and not self.lastpresssed:
            self.lastpresssed = True
            if self.fullscreen == 0:
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT),pygame.FULLSCREEN)
                self.fullscreen = 1
            else:
                self.fullscreen = 0
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))

        if not pygame.key.get_pressed()[pygame.K_F11]:
            self.lastpresssed  = False
graph.py 文件源码 项目:SerialGraphicator 作者: newtonis 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def Refresh(self):
        self.screen.fill((255,255,255))
        self.App.Refresh()
        pygame.display.update()
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if pygame.key.get_pressed()[pygame.K_LCTRL] and pygame.key.get_pressed()[pygame.K_s] and not self.flag:
            self.flag = True
            name =  str( time.time() )+ ".png"
            pygame.image.save(self.screen , str( time.time() )+ ".png")
            print "screenshot ",name," saved"

        if pygame.key.get_pressed()[ pygame.K_F11 ] and not self.lastpresssed:
            self.lastpresssed = True
            if self.fullscreen == 0:
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT),pygame.FULLSCREEN)
                self.fullscreen = 1
            else:
                self.fullscreen = 0
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))

        if not pygame.key.get_pressed()[pygame.K_F11]:
            self.lastpresssed  = False
graph.py 文件源码 项目:SerialGraphicator 作者: newtonis 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def Refresh(self):
        self.screen.fill((255,255,255))
        self.App.Refresh()
        pygame.display.update()
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if not pygame.key.get_pressed()[pygame.K_LCTRL]:
            self.flag = False
        if pygame.key.get_pressed()[pygame.K_LCTRL] and pygame.key.get_pressed()[pygame.K_s] and not self.flag:
            self.flag = True
            name =  str( time.time() )+ ".png"
            pygame.image.save(self.screen , str( time.time() )+ ".png")
            print "screenshot ",name," saved"

        if pygame.key.get_pressed()[ pygame.K_F11 ] and not self.lastpresssed:
            self.lastpresssed = True
            if self.fullscreen == 0:
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT),pygame.FULLSCREEN)
                self.fullscreen = 1
            else:
                self.fullscreen = 0
                self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))

        if not pygame.key.get_pressed()[pygame.K_F11]:
            self.lastpresssed  = False
MainMenu.py 文件源码 项目:opseilen 作者: Baal221 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
                # Resolution
                self.width = 800
                self.height = 600
                self.resolution = (self.width,self.height)
                #self.fullscreen = pygame.FULLSCREEN

                pygame.init() # Makes pygame work

                # Set the resolution
                self.screen = pygame.display.set_mode(self.resolution)

                # Set Title
                self.caption = pygame.display.set_caption('Main Menu')

                # Set default font
                self.font = pygame.font.Font(None, 30)

                self.Rects = Rects(self)
graphics.py 文件源码 项目:n1mm_view 作者: n1kdo 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def init_display():
    """
    set up the pygame display, full screen
    """

    # Check which frame buffer drivers are available
    # Start with fbcon since directfb hangs with composite output
    drivers = ['fbcon', 'directfb', 'svgalib', 'directx', 'windib']
    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:
            pygame.display.init()
        except pygame.error:
            #  logging.warn('Driver: %s failed.' % driver)
            continue
        found = True
        logging.debug('using %s driver', driver)
        break

    if not found:
        raise Exception('No suitable video driver found!')

    size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
    pygame.mouse.set_visible(0)
    if driver != 'directx':  # debugging hack runs in a window on Windows
        screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
    else:
        logging.info('running in windowed mode')
        # set window origin for windowed usage
        os.putenv('SDL_VIDEO_WINDOW_POS', '0,0')
        # size = (size[0]-10, size[1] - 30)
        screen = pygame.display.set_mode(size, pygame.NOFRAME)

    logging.debug('display size: %d x %d', size[0], size[1])
    # Clear the screen to start
    screen.fill(BLACK)
    return screen, size
game_functions.py 文件源码 项目:pyclimber 作者: manixaist 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def check_keydown_events(settings, event, screen, tile_map):
    """Respond to key down events"""
    player = tile_map.player
    if event.key == pygame.K_ESCAPE:
        sys.exit()

    if event.key == pygame.K_a:
        generate_new_random_blob(settings, screen, settings.image_res.enemy_blob_images, tile_map)

    if event.key == pygame.K_r:
        reset_game(tile_map)

    if event.key == pygame.K_LEFT:
        if not player.idle_top:
            if player.dx == 0.0:
                player.dx = -1 * settings.player_dx
                player.facing_left = True

    if event.key == pygame.K_RIGHT:
        if not player.idle_top:
            if player.dx == 0.0:
                player.dx = settings.player_dx
                player.facing_left = False

    if event.key == pygame.K_F9:
        if settings.fullscreen == True:
            settings.fullscreen = False
            pygame.display.set_mode((800, 600))
        else:
            settings.fullscreen = True
            pygame.display.set_mode((800, 600), pygame.FULLSCREEN)
photobooth_main.py 文件源码 项目:photobooth 作者: eoghan-c 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def init_pygame(self):
        pygame.init()
        self.size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
        print "Initialised PyGame: Screen Width " + str(self.size[0]) + " x Height " + str(self.size[1])

        pygame.display.set_caption('Photo Booth')
        pygame.mouse.set_visible(False) # Hide the mouse cursor
        self.screen = pygame.display.set_mode(self.size, pygame.FULLSCREEN)
ui.py 文件源码 项目:mqtt-control-panel 作者: colinodell 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, background = None):
        # Init framebuffer/touchscreen environment variables
        os.putenv('SDL_VIDEODRIVER', 'fbcon')
        os.putenv('SDL_FBDEV', '/dev/fb1')
        os.putenv('SDL_MOUSEDRV', 'TSLIB')
        os.putenv('SDL_MOUSEDEV', '/dev/input/touchscreen')

        self._backlight_on = True
        self.on()

        # Init pygame and screen
        print "Initting..."
        pygame.init()
        print "Setting Mouse invisible..."
        pygame.mouse.set_visible(False)
        print "Setting fullscreen..."
        modes = pygame.display.list_modes(16)
        self._screen = pygame.display.set_mode(modes[0], pygame.FULLSCREEN, 16)
        self._needs_update = True

        # Load background
        self._background = pygame.image.load(background)
        self._screen.fill(0)
        self._screen.blit(self._background, (0, 0))
        pygame.display.update()

        # Load font
        self._font = pygame.font.SysFont("Arial", 24)

        self._images = []
        self._buttons = []
        self._status_lines = []

        self.update()
menus.py 文件源码 项目:project_xcape 作者: OthmanEmpire 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def handleEvent(self, event):
        if event.type == pg.KEYDOWN:

            if event.key == pg.K_ESCAPE:
                self.effect.timeStartDarken = self.effect.time
                self.effect.timeEndDarken = self.effect.time + self.dt
                self.audio.state = "exit"

            if event.key == pg.K_UP:
                self.arrow.moveUp()
            if event.key == pg.K_DOWN:
                self.arrow.moveDown()

            if self.arrow.index == 0:
                if event.key == pg.K_RIGHT:
                    self.backgroundSetting.next()
                if event.key == pg.K_LEFT:
                    self.backgroundSetting.previous()
                if event.key == pg.K_RETURN:
                    if self.backgroundSetting.index == 0:
                        self.render.flip(True, False)
                    if self.backgroundSetting.index == 1:
                        self.render.flip(False, True)

            if self.arrow.index == 1:
                if event.key == pg.K_RIGHT:
                    self.fullscreenSetting.next()
                if event.key == pg.K_LEFT:
                    self.fullscreenSetting.previous()
                if event.key == pg.K_RETURN:
                    if self.fullscreenSetting.index == 0:
                        pg.display.set_mode((settings.WIDTH, settings.HEIGHT))
                    if self.fullscreenSetting.index == 1:
                        pg.display.set_mode((settings.WIDTH, settings.HEIGHT),
                                            pg.FULLSCREEN)

                    self.messageMenu("screen")
                    self.messageScene("screen")
                    self.messageCutScene("screen")
mock_booth.py 文件源码 项目:pi-photo-booth 作者: gamblecd 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __initScreen(self):
        pygame.init()
        self.screen = pygame.display.set_mode([1920, 1200], pygame.FULLSCREEN)
        pygame.display.update()
        self.outputScreen = OutputScreen(self.screen)
rexmenu.py 文件源码 项目:rexmenu 作者: robmcmullen 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def setup(self):
        self.font = pygame.font.Font(None, 30)
        if self.cfg is not None:
            self.parse_games_cfg(self.cfg)
        else:
            self.parse_games()
        if self.windowed:
            flags = 0
        else:
            flags = pygame.FULLSCREEN
            info = pygame.display.Info()
            self.w = info.current_w
            self.h = info.current_h
        self.screen = pygame.display.set_mode((self.w, self.h), flags)
        pygame.mouse.set_visible(False)
test_pygame.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, resolution=(640, 480), cmdline=""):
        self.color = (0,0,0)
        self.resolution = resolution
        if "--fullscreen" in cmdline:
            self.window = \
                pygame.display.set_mode(self.resolution, pygame.FULLSCREEN) 
        else:
            self.window = pygame.display.set_mode(self.resolution)
        # pygame.display.set_mode() verändert die Größe des Fensters
        # Über das zweite Argument, pygame.FULLSCREEN, kann das Fenster
        # in den Vollbildmodus versetzt werden

        pygame.display.set_caption('A Simple Yet Insightful Pygame Example') 
        # Verändert die Beschriftung des Fensters

        pygame.mouse.set_visible(0)
        # Verhindert, dass die Maus gezeigt wird

        self.screen = pygame.display.get_surface()
        # Generiert ein Surface des Fensters
        # Siehe: Allgemeines über Surfaces

        self.screen.fill(self.color)
        # Füllt das Surface self.screen mit der übergebenen Farbe
        # Siehe: Allgemeines über Farben

        self.screen_rect = self.screen.get_rect()
        # Rectangle des Fensters
        # Siehe: Allgemeines über Rectangles
booth_app.py 文件源码 项目:photobooth 作者: maduck 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 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)
graphics.py 文件源码 项目:pool 作者: max-kov 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self):
        if config.fullscreen:
            config.set_max_resolution()
            self.surface = pygame.display.set_mode(config.resolution, pygame.FULLSCREEN)
        else:
            self.surface = pygame.display.set_mode(config.resolution)
        self.background = pygame.Surface(self.surface.get_size())
        self.background = self.background.convert()
        self.background.fill(config.table_color)
        self.surface.blit(self.background, (0, 0))
walton.py 文件源码 项目:OfMagesAndMagic 作者: munnellg 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
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'])
cnc_display.py 文件源码 项目:MonitorDarkly 作者: RedBalloonShenanigans 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def main():
    pg.init()
    screen = pg.display.set_mode((1920,1200), pg.FULLSCREEN|pg.DOUBLEBUF|pg.HWSURFACE)

    lock = image.DellImage("lock_https.gif")
    packet = cnc_packet.build_upload_packet(cnc_packet.build_image_blob(lock, 50, 50))
    display_packet(packet, screen)

    while True:
        x, y = pg.mouse.get_pos()
        packet = cnc_packet.build_cursor_packet(x, y)
        display_packet(packet, screen)
slither.py 文件源码 项目:Slither 作者: PySlither 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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)
app.py 文件源码 项目:BlueDot 作者: martinohanlon 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, device, server, fullscreen, width, height):

        #init pygame
        pygame.init()

        #load font
        font = pygame.font.SysFont(FONT, FONTSIZE)

        #setup the screen
        #set the screen caption
        pygame.display.set_caption("Blue Dot")

        #create the screen
        screenflags = 0

        if fullscreen:
            screenflags = pygame.FULLSCREEN
            if width == None and height == None:
                display_info = pygame.display.Info()
                width = display_info.current_w
                height = display_info.current_h

        if width == None: width = DEFAULTSIZE[0]
        if height == None: height = DEFAULTSIZE[1]

        screen = pygame.display.set_mode((width, height), screenflags)

        #has a server been specified?  If so connected directly
        if server:
            button_screen = ButtonScreen(screen, font, device, server, width, height)
            button_screen.run()
        else:
            #start the devices screen
            devices_screen = DevicesScreen(screen, font, device, width, height)
            devices_screen.run()

        pygame.quit()
pygame_test.py 文件源码 项目:ATLeS 作者: liffiton 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
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
tools.py 文件源码 项目:planet-hopper 作者: reddit-pygame 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def toggle_fullscreen(self, key):
        if key == pg.K_F1:
            screen_size = pg.display.get_surface().get_size()
            self.fullscreen = not self.fullscreen
            if self.fullscreen:
                self.screen = pg.display.set_mode(screen_size, pg.FULLSCREEN)
            else:
                self.screen = pg.display.set_mode(screen_size)


问题


面经


文章

微信
公众号

扫码关注公众号