當前位置: 首頁>>代碼示例>>Python>>正文


Python pyglet.options方法代碼示例

本文整理匯總了Python中pyglet.options方法的典型用法代碼示例。如果您正苦於以下問題:Python pyglet.options方法的具體用法?Python pyglet.options怎麽用?Python pyglet.options使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyglet的用法示例。


在下文中一共展示了pyglet.options方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _init_pyglet

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def _init_pyglet(self):
        import pyglet
        pyglet.options['shadow_window'] = False

        self._window = None
        conf = pyglet.gl.Config(
            depth_size=24,
            double_buffer=True,
            major_version=3,
            minor_version=2
        )
        try:
            self._window = pyglet.window.Window(config=conf, visible=False,
                                                resizable=False, width=1, height=1)
        except Exception as e:
            raise ValueError('Failed to initialize Pyglet window with an OpenGL >= 3+ context. ' \
                             'If you\'re logged in via SSH, ensure that you\'re running your script ' \
                             'with vglrun (i.e. VirtualGL). Otherwise, the internal error message was: ' \
                             '"{}"'.format(e.message)) 
開發者ID:BerkeleyAutomation,項目名稱:meshrender,代碼行數:21,代碼來源:render.py

示例2: _error_handler

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def _error_handler(display, event):
    # By default, all errors are silently ignored: this has a better chance
    # of working than the default behaviour of quitting ;-)
    #
    # We've actually never seen an error that was our fault; they're always
    # driver bugs (and so the reports are useless).  Nevertheless, set
    # environment variable PYGLET_DEBUG_X11 to 1 to get dumps of the error
    # and a traceback (execution will continue).
    if pyglet.options['debug_x11']:
        event = event.contents
        buf = c_buffer(1024)
        xlib.XGetErrorText(display, event.error_code, buf, len(buf))
        print 'X11 error:', buf.value
        print '   serial:', event.serial
        print '  request:', event.request_code
        print '    minor:', event.minor_code
        print ' resource:', event.resourceid

        import traceback
        print 'Python stack trace (innermost last):'
        traceback.print_stack()
    return 0 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:24,代碼來源:__init__.py

示例3: set_exclusive_keyboard

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def set_exclusive_keyboard(self, exclusive=True):
        # http://developer.apple.com/mac/library/technotes/tn2002/tn2062.html
        # http://developer.apple.com/library/mac/#technotes/KioskMode/

        # BUG: System keys like F9 or command-tab are disabled, however
        # pyglet also does not receive key press events for them.

        # This flag is queried by window delegate to determine whether
        # the quit menu item is active.
        self._is_keyboard_exclusive = exclusive

        if exclusive:
            # "Be nice! Don't disable force-quit!"
            #          -- Patrick Swayze, Road House (1989)
            options = cocoapy.NSApplicationPresentationHideDock | \
                      cocoapy.NSApplicationPresentationHideMenuBar | \
                      cocoapy.NSApplicationPresentationDisableProcessSwitching | \
                      cocoapy.NSApplicationPresentationDisableHideApplication
        else:
            options = cocoapy.NSApplicationPresentationDefault

        NSApp = NSApplication.sharedApplication()
        NSApp.setPresentationOptions_(options) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:25,代碼來源:__init__.py

示例4: _error_handler

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def _error_handler(display, event):
    # By default, all errors are silently ignored: this has a better chance
    # of working than the default behaviour of quitting ;-)
    #
    # We've actually never seen an error that was our fault; they're always
    # driver bugs (and so the reports are useless).  Nevertheless, set
    # environment variable PYGLET_DEBUG_X11 to 1 to get dumps of the error
    # and a traceback (execution will continue).
    import pyglet
    if pyglet.options['debug_x11']:
        event = event.contents
        buf = c_buffer(1024)
        xlib.XGetErrorText(display, event.error_code, buf, len(buf))
        print('X11 error:', buf.value)
        print('   serial:', event.serial)
        print('  request:', event.request_code)
        print('    minor:', event.minor_code)
        print(' resource:', event.resourceid)

        import traceback
        print('Python stack trace (innermost last):')
        traceback.print_stack()
    return 0 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:25,代碼來源:xlib.py

示例5: init_context

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def init_context(self):
        import pyglet
        pyglet.options['shadow_window'] = False

        self._window = None
        conf = pyglet.gl.Config(
            sample_buffers=1, samples=4,
            depth_size=24,
            double_buffer=True,
            major_version=OPEN_GL_MAJOR,
            minor_version=OPEN_GL_MINOR
        )
        try:
            self._window = pyglet.window.Window(config=conf, visible=False,
                                                resizable=False,
                                                width=1, height=1)
        except Exception as e:
            raise ValueError(
                'Failed to initialize Pyglet window with an OpenGL >= 3+ '
                'context. If you\'re logged in via SSH, ensure that you\'re '
                'running your script with vglrun (i.e. VirtualGL). The '
                'internal error message was "{}"'.format(e)
            ) 
開發者ID:musyoku,項目名稱:gqn-dataset-renderer,代碼行數:25,代碼來源:platforms.py

示例6: dump_pyglet

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def dump_pyglet():
    '''Dump pyglet version and options.'''
    import pyglet
    print 'pyglet.version:', pyglet.version
    print 'pyglet.__file__:', pyglet.__file__
    for key, value in pyglet.options.items():
        print "pyglet.options['%s'] = %r" % (key, value) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:9,代碼來源:info.py

示例7: _create_shadow_window

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def _create_shadow_window():
    global _shadow_window

    import pyglet
    if not pyglet.options['shadow_window'] or _is_epydoc:
        return

    from pyglet.window import Window
    _shadow_window = Window(width=1, height=1, visible=False)
    _shadow_window.switch_to()

    from pyglet import app
    app.windows.remove(_shadow_window) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:15,代碼來源:__init__.py

示例8: set_vsync

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def set_vsync(self, vsync):
        if pyglet.options['vsync'] is not None:
            vsync = pyglet.options['vsync']
        self._vsync = vsync # _recreate depends on this
        swap = c_long(int(vsync))
        agl.aglSetInteger(self._agl_context, agl.AGL_SWAP_INTERVAL, byref(swap)) 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:8,代碼來源:__init__.py

示例9: set_vsync

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def set_vsync(self, vsync):
        if pyglet.options['vsync'] is not None:
            vsync = pyglet.options['vsync']
        if wgl_info.have_extension('WGL_EXT_swap_control'):
            wglext_arb.wglSwapIntervalEXT(int(vsync))
        else:
            warnings.warn('Could not set vsync; unsupported extension.') 
開發者ID:shrimpboyho,項目名稱:flappy-bird-py,代碼行數:9,代碼來源:__init__.py

示例10: require_platform

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def require_platform(platform):
    """
    Only run the test on the given platform(s), skip on other platforms.

    :param list(str) platform: A list of platform identifiers as returned by
        :data:`pyglet.options`. See also :class:`tests.annotations.Platform`.
    """
    return pytest.mark.skipif(pyglet.compat_platform not in platform,
                              reason='requires platform: %s' % str(platform)) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:11,代碼來源:annotations.py

示例11: skip_platform

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def skip_platform(platform):
    """
    Skip test on the given platform(s).

    :param list(str) platform: A list of platform identifiers as returned by
        :data:`pyglet.options`. See also :class:`tests.annotations.Platform`.
    """
    return pytest.mark.skipif(pyglet.compat_platform in platform,
                              reason='not supported for platform: %s' % str(platform)) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:11,代碼來源:annotations.py

示例12: dump_pyglet

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def dump_pyglet():
    """Dump pyglet version and options."""
    import pyglet
    print('pyglet.version:', pyglet.version)
    print('pyglet.compat_platform:', pyglet.compat_platform)
    print('pyglet.__file__:', pyglet.__file__)
    for key, value in pyglet.options.items():
        print("pyglet.options['%s'] = %r" % (key, value)) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:10,代碼來源:info.py

示例13: dump_ffmpeg

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def dump_ffmpeg():
    """Dump FFmpeg info."""
    import pyglet
    pyglet.options['search_local_libs'] = True
    import pyglet.media

    if pyglet.media.have_ffmpeg():
        from pyglet.media.codecs.ffmpeg import get_version
        print('FFmpeg version:', get_version())
    else:
        print('FFmpeg not available.') 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:13,代碼來源:info.py

示例14: _create_shadow_window

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def _create_shadow_window():
    global _shadow_window

    import pyglet
    if not pyglet.options['shadow_window'] or _is_pyglet_doc_run:
        return

    from pyglet.window import Window
    _shadow_window = Window(width=1, height=1, visible=False)
    _shadow_window.switch_to()

    from pyglet import app
    app.windows.remove(_shadow_window) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:15,代碼來源:__init__.py

示例15: set_vsync

# 需要導入模塊: import pyglet [as 別名]
# 或者: from pyglet import options [as 別名]
def set_vsync(self, vsync):
        if pyglet.options['vsync'] is not None:
            vsync = pyglet.options['vsync']

        self._interval = vsync

        if not self._fullscreen:
            # Disable interval if composition is enabled to avoid conflict with DWM.
            if self._always_dwm or self._dwm_composition_enabled():
                vsync = 0

        self.context.set_vsync(vsync) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:14,代碼來源:__init__.py


注:本文中的pyglet.options方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。