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: MAIN.py From DUGA with Mozilla Public License 2.0 | 6 votes |
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 #2
Source File: core_choices_dynamic.py From Retropie-CRT-Edition with GNU General Public License v3.0 | 6 votes |
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 #3
Source File: eduactiv8.py From eduActiv8 with GNU General Public License v3.0 | 6 votes |
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 #4
Source File: weather.py From PiWeatherRock with MIT License | 6 votes |
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 #5
Source File: ui.py From pi-tracking-telescope with MIT License | 6 votes |
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 #6
Source File: ui.py From rpi_lcars with MIT License | 6 votes |
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 #7
Source File: pygame_functions.py From Pygame_Functions with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: pygame_functions.py From Pygame_Functions with GNU General Public License v2.0 | 6 votes |
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 #9
Source File: __init__.py From DIY-Thermocam with GNU General Public License v3.0 | 6 votes |
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 #10
Source File: __init__.py From DIY-Thermocam with GNU General Public License v3.0 | 6 votes |
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 #11
Source File: display_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
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 #12
Source File: display_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
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 |
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: display_test.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
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 #15
Source File: pyrat.py From PyRat with GNU General Public License v3.0 | 5 votes |
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 #16
Source File: pattern_generator.py From Retropie-CRT-Edition with GNU General Public License v3.0 | 5 votes |
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 #17
Source File: config_core.py From Retropie-CRT-Edition with GNU General Public License v3.0 | 5 votes |
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)
Example #18
Source File: config_core.py From Retropie-CRT-Edition with GNU General Public License v3.0 | 5 votes |
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() # screen self.m_lResolutionXY = get_screen_resolution() self._side_and_size() self.m_oScreen = pygame.display.set_mode(self.m_lResolutionXY, pygame.FULLSCREEN)
Example #19
Source File: gui.py From ct-Raspi-Radiowecker with GNU General Public License v3.0 | 5 votes |
def display_init(self): # try to create a surface and check if it fails try: # fullscreen is the default if self.fullscreen: # create a hardware accelerated fullscreen surface self.display_surface = pygame.display.set_mode( self.display_size, pygame.FULLSCREEN) # alternatively try a windowed surface else: self.display_surface = pygame.display.set_mode(size=self.window_size, flags=pygame.RESIZABLE, display=1) except Exception as exc: print(exc) print("Display initialization failed. This program needs a running X-Server.") exit() self.loadImageCache() # get absolute size of the surface independend from what was # requested. self.display_size = self.display_surface.get_size() self.current_wallpaper_surface = pygame.image.load( self.wallpaper_path + "/wallpaper.jpg") self.current_wallpaper_surface = aspect_scale( self.current_wallpaper_surface, self.display_size).convert()
Example #20
Source File: game_items.py From alien-invasion-game with MIT License | 5 votes |
def __init__(self, ai_settings: Settings, stats: GameStats, **kwargs: game_items_types): """Initialize with default items unless specified in kwargs.""" # Default initializations for game items. # Initialize screen. flags = pygame.HWSURFACE | pygame.DOUBLEBUF # | pygame.FULLSCREEN self.screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height), flags) pygame.display.set_caption("Alien Invasion Game") # Initialize ship. self.ship = Ship(ai_settings, self.screen) # Initialize aliens group. self.aliens = Group() # Initialize bullets group. self.bullets = Group() # Initialize buttons. self.play_button = Button(self.screen, "Play!") # TODO implement Restart and Cancel buttons. # self.restart_button = Button(self.screen, "Restart") # self.cancel_button = Button(self.screen, "Cancel", (255, 0, 0, 80)) # self.set_button_pos() # Initialize scorecard. self.sb = Scorecard(ai_settings, stats, self.screen) # Set the game items for those default values are given. for game_item in kwargs: if game_item in self.acceptable_game_items: self.__setattr__(game_item, kwargs[game_item])
Example #21
Source File: scene.py From wasabi2d with GNU Lesser General Public License v3.0 | 5 votes |
def _make_context(self, width, height): """Create the ModernGL context.""" glconfig = { 'GL_CONTEXT_MAJOR_VERSION': 4, 'GL_CONTEXT_PROFILE_MASK': pygame.GL_CONTEXT_PROFILE_CORE, } for k, v in glconfig.items(): k = getattr(pygame, k) pygame.display.gl_set_attribute(k, v) dims = width, height flags = pygame.OPENGL | pygame.DOUBLEBUF if self.fullscreen: # SDL's detection for "legacy" fullscreen seems to fail on # Ubuntu 16.04 at least. Set an environment variable so that it # asks the Window Manager for full screen mode instead. # https://github.com/spurious/SDL-mirror/blob/c8b01e282dfd49ea8bbf1faec7fd65d869ea547f/src/video/x11/SDL_x11window.c#L1468 os.environ['SDL_VIDEO_X11_LEGACY_FULLSCREEN'] = "0" flags |= pygame.FULLSCREEN if not self._scaler: self._scaler = 'linear' dims = 0, 0 elif self._scaler: flags |= pygame.SCALED pygame.display.set_mode( dims, flags=flags, depth=24 ) ctx = moderngl.create_context(require=410) self._real_size = pygame.display.get_window_size() if self._real_size != (width, height): self.drawer = self._make_scaler(ctx, (width, height)) return ctx
Example #22
Source File: window_pygame.py From Tickeys-linux with MIT License | 5 votes |
def toggle_fullscreen(self): if self.flags & pygame.FULLSCREEN: self.flags &= ~pygame.FULLSCREEN else: self.flags |= pygame.FULLSCREEN self._pygame_set_mode()
Example #23
Source File: window_pygame.py From Tickeys-linux with MIT License | 5 votes |
def toggle_fullscreen(self): if self.flags & pygame.FULLSCREEN: self.flags &= ~pygame.FULLSCREEN else: self.flags |= pygame.FULLSCREEN self._pygame_set_mode()
Example #24
Source File: pygcurse.py From universalSmashSystem with GNU General Public License v3.0 | 5 votes |
def _propsetfont(self, value): self._font = value # TODO - a lot of this code is copy/paste self._cellwidth, self._cellheight = calcfontsize(self._font) if self._managesdisplay and self._fullscreen: self._windowsurface = pygame.display.set_mode((self._cellwidth * self.width, self._cellheight * self.height), pygame.FULLSCREEN) elif self._managesdisplay: self._windowsurface = pygame.display.set_mode((self._cellwidth * self.width, self._cellheight * self.height)) self._pixelwidth = self._width * self._cellwidth self._pixelheight = self._height * self._cellheight self._surfaceobj = pygame.Surface((self._pixelwidth, self._pixelheight)) self._surfaceobj = self._surfaceobj.convert_alpha() # TODO - This is needed for erasing, but does this have a performance hit? self._screendirty = [[True] * self._height for i in range(self._width)] if self._autoupdate: self.update()
Example #25
Source File: pygcurse.py From universalSmashSystem with GNU General Public License v3.0 | 5 votes |
def __init__(self, width=80, height=25, caption=None, font=None, fgcolor=DEFAULTFGCOLOR, bgcolor=DEFAULTBGCOLOR, fullscreen=False): pygame.init() self._fullscreen = fullscreen fullscreen = fullscreen and FULLSCREEN or _NEW_WINDOW if sys.version.startswith('2.'): super(PygcurseWindow, self).__init__(width, height, font, fgcolor, bgcolor, fullscreen) # for Python 2 else: super().__init__(width, height, font, fgcolor, bgcolor, fullscreen) # for Python 3 and later if caption is not None: pygame.display.set_caption(caption)
Example #26
Source File: pygcurse.py From universalSmashSystem with GNU General Public License v3.0 | 5 votes |
def _propsetfullscreen(self, value): if value and not self._fullscreen: self._fullscreen = True self._windowsurface = pygame.display.set_mode((self.pixelwidth, self.pixelheight), pygame.FULLSCREEN) elif not value and self._fullscreen: self._fullscreen = False self._windowsurface = pygame.display.set_mode((self.pixelwidth, self.pixelheight))
Example #27
Source File: main.py From Hermit with MIT License | 5 votes |
def keyupdowncontrol(event): global keyseq, showconsole, fullscreen if event.type == pygame.QUIT: sys.exit() man.keyupdowncontrol(event,horse) if event.type == pygame.KEYDOWN: if showconsole: k = pygame.key.name(event.key) #print k if k == "return": exe("".join(keyseq)) showconsole = False elif k == "space": keyseq.append(" ") elif k == "-": keyseq.append("-") elif len(k) == 1: keyseq.append(k) elif event.key == pygame.K_BACKSPACE : if len(keyseq) > 0: keyseq.pop() if event.key == pygame.K_SLASH: showconsole = not showconsole if showconsole: settings.msg = ["CONSOLE READY.",settings.msgt] else: settings.msg = ["",settings.msgt] keyseq = [] if event.key == pygame.K_f and not showconsole: fullscreen = not fullscreen if fullscreen: pygame.display.set_mode([width/2,height+50],pygame.FULLSCREEN) else: pygame.display.set_mode([width/2,height+50]) pygame.display.set_caption("")
Example #28
Source File: window.py From moderngl-window with MIT License | 5 votes |
def __init__(self, **kwargs): super().__init__(**kwargs) pygame.display.init() pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, self.gl_version[0]) pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, self.gl_version[1]) pygame.display.gl_set_attribute(pygame.GL_CONTEXT_PROFILE_MASK, pygame.GL_CONTEXT_PROFILE_CORE) pygame.display.gl_set_attribute(pygame.GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, 1) pygame.display.gl_set_attribute(pygame.GL_DOUBLEBUFFER, 1) pygame.display.gl_set_attribute(pygame.GL_DEPTH_SIZE, 24) if self.samples > 1: pygame.display.gl_set_attribute(pygame.GL_MULTISAMPLEBUFFERS, 1) pygame.display.gl_set_attribute(pygame.GL_MULTISAMPLESAMPLES, self.samples) self._depth = 24 self._flags = pygame.OPENGL | pygame.DOUBLEBUF if self.fullscreen: self._flags |= pygame.FULLSCREEN info = pygame.display.Info() desktop_size = info.current_w, info.current_h self._width, self._height = desktop_size self._buffer_width, self._buffer_height = self._width, self._height else: if self.resizable: self._flags |= pygame.RESIZABLE self._set_mode() self.title = self._title self.cursor = self._cursor self.init_mgl_context() self.set_default_viewport()
Example #29
Source File: window.py From pibooth with MIT License | 5 votes |
def toggle_fullscreen(self): """Set window to full screen or initial size. """ if self.is_fullscreen: self.is_fullscreen = False # Set before resize pygame.mouse.set_cursor(*self._cursor) self.surface = pygame.display.set_mode(self.__size, pygame.RESIZABLE) else: self.is_fullscreen = True # Set before resize # Make an invisible cursor (don't use pygame.mouse.set_visible(False) because # the mouse event will always return the window bottom-right coordinate) pygame.mouse.set_cursor((8, 8), (0, 0), (0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0)) self.surface = pygame.display.set_mode(self.display_size, pygame.FULLSCREEN) self.update()
Example #30
Source File: cnc_display.py From MonitorDarkly with GNU General Public License v3.0 | 5 votes |
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)