Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pygame full screen help
#1
Hi after a bit of help with a bit of code, trying to a game a game to be full in fullscreen. But at the moment its tiny and in the middle of the screen. I`m using a composite set at 720.480.
the code is not mine so this is why i need help figuring it out.
import os, pygame


#Define display class
class pyscope :
    
    screen = None
    pySurface = None
    
    def __init__(self):
        
        "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")
        
        # Check which frame buffer drivers are available
        # Start with fbcon since directfb hangs with composite output
        drivers = ['fbcon', 'directfb', 'svgalib']
        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:
                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)
        flags = pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.FULLSCREEN
        self.screen = pygame.display.set_mode(size, flags)
        surface = pygame.Surface((320,240),pygame.FULLSCREEN)
        pygame.display.set_mode((320,240),pygame.FULLSCREEN)
        self.pySurface = surface.convert()
        # Initialise font support
        pygame.font.init()
 
    def __del__(self):
        "Destructor to make sure pygame shuts down, etc."
Reply


Messages In This Thread
pygame full screen help - by corsasri - Jul-19-2020, 11:04 AM
RE: pygame full screen help - by nilamo - Jul-24-2020, 12:50 AM
RE: pygame full screen help - by reginarodriguez - Mar-20-2024, 07:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 1 1,041 Apr-30-2023, 10:11 PM
Last Post: deanhystad
  [PyGame] Pygame : clearing a screen issue Reldaing 4 6,207 Jun-23-2020, 09:10 AM
Last Post: JudyLarose
  [PyGame] How to Display pygame on SSD1351 screen kalihotname 0 1,907 Nov-11-2019, 07:32 AM
Last Post: kalihotname
  [PyGame] pygame.draw.rect function stretches across the screen instead of moving BubblesTheGiraffe 2 3,710 Jun-11-2019, 08:32 PM
Last Post: metulburr
  podsixnet,pyopengl and pygame api list?(full) hsunteik 4 4,907 Feb-17-2017, 09:44 PM
Last Post: nilamo
  [PyGame] Copying the Screen (PyGame) Zman350x 4 5,192 Feb-11-2017, 08:26 PM
Last Post: Zman350x

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020