joystick.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:picraftzero 作者: WayneKeenan 项目源码 文件源码
def _setup_video():
        "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")

        # Check which frame buffer drivers are available
        # Start with fbcon since directfb hangs with composite output
        drivers = ['x11', 'fbcon', 'directfb', 'svgalib', 'Quartz']
        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:
                logger.error('Driver: {0} failed.'.format(driver))
                continue
            found = True
            break

        if not found:
            logger.error('No suitable SDL video driver found to start the event subsystem, pygame joysticks may not work.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号