Python pygame.FULLSCREEN Examples

The following are 30 code examples of pygame.FULLSCREEN(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygame , or try the search function .
Example #1
Source File: pygame_functions.py    From Pygame_Functions with GNU General Public License v2.0 6 votes vote down vote up
def screenSize(sizex, sizey, xpos=None, ypos=None, fullscreen=False):
    global screen
    global background
    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])
    background = Background()
    screen.fill(background.colour)
    pygame.display.set_caption("Graphics Window")
    background.surface = screen.copy()
    pygame.display.update()
    return screen 
Example #2
Source File: ui.py    From pi-tracking-telescope with MIT License 6 votes vote down vote up
def __init__(self, screen, resolution=(800,480), 
                 ui_placement_mode=False, fps=60, dev_mode=False,
                 audio=(22050, -8, 1, 1024)):
        # init system
        try:
            if (audio): pygame.mixer.init(audio[0], audio[1], audio[2], audio[3])
        except:
            pass
        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 
Example #3
Source File: __init__.py    From DIY-Thermocam with GNU General Public License v3.0 6 votes vote down vote up
def setup():
    global screen

    # Init pygame
    pygame.init()

    # Init screen
    screen = pygame.display.set_mode((640, 480), pygame.FULLSCREEN)

    # Disable mouse
    pygame.mouse.set_visible(False)

    # Display welcome message
    displayText("DIY-Thermocam Video Module", True)


# Main Program 
Example #4
Source File: __init__.py    From DIY-Thermocam with GNU General Public License v3.0 6 votes vote down vote up
def setup():
    global screen

    # Init pygame
    pygame.init()

    # Init screen
    screen = pygame.display.set_mode((640, 480), pygame.FULLSCREEN)

    # Disable mouse
    pygame.mouse.set_visible(False)

    # Display welcome message
    displayText("DIY-Thermocam Video Module", True)


# Main Program 
Example #5
Source File: weather.py    From PiWeatherRock with MIT License 6 votes vote down vote up
def sizing(self, size):
        """
        Set various asplect of the app related to the screen size of
        the display and/or window.
        """

        self.log.debug(f"Framebuffer Size: {size[0]} x {size[1]}")

        if self.config["fullscreen"]:
            self.screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
            self.xmax = pygame.display.Info().current_w #  - 35 Why not use full screen in "fullescreen"?
            self.ymax = pygame.display.Info().current_h #  - 5 Why not use full screen in "fullescreen"?
        else:
            self.screen = pygame.display.set_mode(size, pygame.RESIZABLE)
            pygame.display.set_caption('PiWeatherRock')
            self.xmax = pygame.display.get_surface().get_width() - 35
            self.ymax = pygame.display.get_surface().get_height() - 5

        if self.xmax <= 1024:
            self.icon_size = '64'
        else:
            self.icon_size = '256' 
Example #6
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def test_list_modes(self):
        modes = pygame.display.list_modes(
            depth=0, flags=pygame.FULLSCREEN, display=0
        )
        # modes == -1 means any mode is supported.
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes()
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes(
            depth=0, flags=0, display=0
        )
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int) 
Example #7
Source File: ui.py    From rpi_lcars with MIT License 6 votes vote down vote up
def __init__(self, screen, resolution=(800,480),
                 ui_placement_mode=False, fps=60, dev_mode=False, audio=True,
                 audio_params=(22050, -8, 1, 1024)):
        # init system
        pygame.display.init()
        pygame.font.init()
        sound.init(audio_params)

        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: 
            # see https://github.com/tobykurien/rpi_lcars/issues/9
            #pygame.mouse.set_visible(False)
            pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0))
        
        # 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 
Example #8
Source File: eduactiv8.py    From eduActiv8 with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #9
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def test_list_modes(self):
        modes = pygame.display.list_modes(
            depth=0, flags=pygame.FULLSCREEN, display=0
        )
        # modes == -1 means any mode is supported.
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes()
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes(
            depth=0, flags=0, display=0
        )
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int) 
Example #10
Source File: core_choices_dynamic.py    From Retropie-CRT-Edition with GNU General Public License v3.0 6 votes vote down vote up
def _init_screen(self):
        pygame.display.init()
        pygame.font.init()
        pygame.mouse.set_visible(0)

        # gfx
        self.m_oFontText = pygame.font.Font(os.path.join(self.m_sSkinPath,
            self.dCFG['font']),
            self.dCFG['font_size'])
        self.dCFG['font_line'] = self.m_oFontText.get_linesize()

        self.be = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['border_corner']))
        self.b = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['border']))
        self.c = pygame.image.load(os.path.join(self.m_sSkinPath, self.dCFG['cursor']))
        self.c = pygame.transform.rotate(self.c, self.m_iRotate)

        # screen
        self.m_lResolutionXY = CRT.get_screen_resolution()
        self.m_lScreenCenter = map(lambda x: x/2, self.m_lResolutionXY)
        self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN) 
Example #11
Source File: pygame_functions.py    From Pygame_Functions with GNU General Public License v2.0 6 votes vote down vote up
def screenSize(sizex, sizey, xpos=None, ypos=None, fullscreen=False):
    global screen
    global background
    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])
    background = Background()
    screen.fill(background.colour)
    pygame.display.set_caption("Graphics Window")
    background.surface = screen.copy()
    pygame.display.update()
    return screen 
Example #12
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def test_list_modes(self):
        modes = pygame.display.list_modes(
            depth=0, flags=pygame.FULLSCREEN, display=0
        )
        # modes == -1 means any mode is supported.
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes()
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes(
            depth=0, flags=0, display=0
        )
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int) 
Example #13
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 6 votes vote down vote up
def test_list_modes(self):
        modes = pygame.display.list_modes(
            depth=0, flags=pygame.FULLSCREEN, display=0
        )
        # modes == -1 means any mode is supported.
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes()
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int)

        modes = pygame.display.list_modes(
            depth=0, flags=0, display=0
        )
        if modes != -1:
            self.assertEqual(len(modes[0]), 2)
            self.assertEqual(type(modes[0][0]), int) 
Example #14
Source File: MAIN.py    From DUGA with Mozilla Public License 2.0 6 votes vote down vote up
def __init__(self, width, height):
        self.width = width
        self.height = height
        self.res_width = 0
        if SETTINGS.mode == 1:
            self.width = int(SETTINGS.canvas_target_width / SETTINGS.resolution) * SETTINGS.resolution
            self.height = SETTINGS.canvas_target_height
            self.res_width = SETTINGS.canvas_actual_width

        if SETTINGS.fullscreen:
            self.window = pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))) ,pygame.FULLSCREEN)
        else:
            self.window = pygame.display.set_mode((self.width, int(self.height+(self.height*0.15))))
        self.canvas = pygame.Surface((self.width, self.height))
        
        pygame.display.set_caption("DUGA")

        self.shade = [pygame.Surface((self.width, self.height)).convert_alpha(),
                      pygame.Surface((self.width, self.height/1.2)).convert_alpha(),
                      pygame.Surface((self.width, self.height/2)).convert_alpha(),
                      pygame.Surface((self.width, self.height/4)).convert_alpha(),
                      pygame.Surface((self.width, self.height/8)).convert_alpha(),
                      pygame.Surface((self.width, self.height/18)).convert_alpha()]
        self.rgba = [SETTINGS.shade_rgba[0], SETTINGS.shade_rgba[1], SETTINGS.shade_rgba[2], int(min(255, SETTINGS.shade_rgba[3]*(50/SETTINGS.shade_visibility)))] 
Example #15
Source File: test_pygame.py    From ConTroll_Remote_Access_Trojan with Apache License 2.0 5 votes vote down vote up
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 
Example #16
Source File: dash.py    From gamedev with MIT License 5 votes vote down vote up
def __init__(self):
        # initialize game settings
        # os.environ['SDL_VIDEO_CENTERED'] = '1'
        # os.environ['SDL_VIDEO_WINDOW_POS'] = '0,0'
        pygame.init()
        # pygame.mixer.init()
        flags = pygame.DOUBLEBUF | pygame.HWSURFACE  # | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode((WIDTH, HEIGHT), flags)
        pygame.display.set_caption("My Game")
        self.clock = pygame.time.Clock()
        self.load_data()
        font = pygame.font.match_font("Ubuntu Mono")
        self.menu = GameMenu(self, "Dash!", ["Play", "Options", "Quit"], font=font, font_size=30,
                             padding=20) 
Example #17
Source File: ui.py    From mqtt-control-panel with MIT License 5 votes vote down vote up
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/event0')

        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() 
Example #18
Source File: app.py    From BlueDot with MIT License 5 votes vote down vote up
def __init__(self, device, server, fullscreen, width, height):

        self._device = device
        self._server = server
        self._fullscreen = fullscreen
        
        #init pygame
        pygame.init()

        #load font
        self._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]

        self._screen = pygame.display.set_mode((width, height), screenflags)

        self._width = width
        self._height = height

        self._run()

        pygame.quit() 
Example #19
Source File: war.py    From gamedev with MIT License 5 votes vote down vote up
def __init__(self):
        pygame.init()
        # pygame.mixer.init()
        flags = pygame.DOUBLEBUF | pygame.HWSURFACE  # | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode((WIDTH, HEIGHT), flags)
        pygame.display.set_caption(TITLE)
        self.clock = pygame.time.Clock()
        self.OFFSET = OFFSET
        self.load_data() 
Example #20
Source File: part_test2.py    From gamedev with MIT License 5 votes vote down vote up
def __init__(self):
        pygame.init()
        flags = pygame.DOUBLEBUF  # | pygame.HWSURFACE | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode((WIDTH, HEIGHT), flags)
        self.clock = pygame.time.Clock()
        self.new() 
Example #21
Source File: part_test_ship.py    From gamedev with MIT License 5 votes vote down vote up
def __init__(self):
        pygame.init()
        flags = pygame.DOUBLEBUF  # | pygame.HWSURFACE | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode((WIDTH, HEIGHT), flags)
        self.clock = pygame.time.Clock()
        self.new() 
Example #22
Source File: cnc_display.py    From MonitorDarkly with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #23
Source File: map_test.py    From gamedev with MIT License 5 votes vote down vote up
def __init__(self):
        pygame.init()
        os.environ['SDL_VIDEODRIVER'] = 'fbcon'
        flags = pygame.DOUBLEBUF | pygame.HWSURFACE  # | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode((WIDTH, HEIGHT), flags)
        self.screen_rect = self.screen.get_rect()
        pygame.display.set_caption("Map Test")
        self.clock = pygame.time.Clock()
        self.load_data() 
Example #24
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def test_mode_ok_fullscreen(self):
        modes = pygame.display.list_modes()
        if modes != -1:
            size = modes[0]
            self.assertNotEqual(pygame.display.mode_ok(
                                size,
                                flags=pygame.FULLSCREEN), 0) 
Example #25
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def test_mode_ok_fullscreen(self):
        modes = pygame.display.list_modes()
        if modes != -1:
            size = modes[0]
            self.assertNotEqual(pygame.display.mode_ok(
                                size,
                                flags=pygame.FULLSCREEN), 0) 
Example #26
Source File: display_test.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def test_mode_ok_fullscreen(self):
        modes = pygame.display.list_modes()
        if modes != -1:
            size = modes[0]
            self.assertNotEqual(pygame.display.mode_ok(
                                size,
                                flags=pygame.FULLSCREEN), 0) 
Example #27
Source File: window_pygame.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def toggle_fullscreen(self):
        if self.flags & pygame.FULLSCREEN:
            self.flags &= ~pygame.FULLSCREEN
        else:
            self.flags |= pygame.FULLSCREEN
        self._pygame_set_mode() 
Example #28
Source File: pyrat.py    From PyRat with GNU General Public License v3.0 5 votes vote down vote up
def main():
    # Start program
    debug("Starting pygame...")
    pygame.init()
    debug("Defining screen object...")
    if not(args.nodrawing):
        if not(args.save_images):
            infoObject = pygame.display.Info()
            image_icon = pygame.image.load("resources/various/pyrat.ico")
            pygame.display.set_icon(image_icon)
            pygame.display.set_caption("PyRat")
            if args.fullscreen:
                screen = pygame.display.set_mode((infoObject.current_w, infoObject.current_h), pygame.FULLSCREEN)
                args.window_width = infoObject.current_w
                args.window_height = infoObject.current_h
            else:
                screen = pygame.display.set_mode((args.window_width, args.window_height), pygame.RESIZABLE)
        else:
            screen = pygame.surface.Surface((args.window_width, args.window_height))            
            infoObject = ""
    else:        
        screen = ""
        infoObject = ""        
    # Run first game
    debug("Starting first game")
    result = run_game(screen, infoObject)
    # Run other games (if any)
    for i in range(args.tests - 1):
        debug("Starting match number " + str(i))
        print("match " + str(i+2) + "/" + str(args.tests))
        new = run_game(screen, infoObject)
        debug("Aggregating stats")
        result = {x: result.get(x, 0) + new.get(x, 0) for x in set(result).union(new)}
    debug("Writing stats and exiting")
    result = {k: v / args.tests for k, v in result.items()}
    # Print stats and exit
    print("{")
    for key,value in sorted(result.items()):
        print("\t\"" + str(key) + "\": " + str(value))
    print("}")
    pygame.quit() 
Example #29
Source File: pattern_generator.py    From Retropie-CRT-Edition with GNU General Public License v3.0 5 votes vote down vote up
def _init_screen(self):
        pygame.display.init()
        pygame.font.init()
        pygame.mouse.set_visible(0)
        self.m_PGoFontText = pygame.font.Font(FONT_FILE,
                                              self.m_PGoFontTextSize)
        self.m_PGoScreen = pygame.display.set_mode((self.m_dPatternAdj["ScreenHSize"],
                                                    self.m_dPatternAdj["ScreenVSize"]),
                                                    pygame.FULLSCREEN) 
Example #30
Source File: config_core.py    From Retropie-CRT-Edition with GNU General Public License v3.0 5 votes vote down vote up
def _pause(self):
        self.m_oJoyHandler.quit()
        if self.m_bPause[0]: self._wait()
        if self.m_bExit: return
        self.m_oJoyHandler.init()
        self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN)