当前位置: 首页>>代码示例>>Python>>正文


Python window.Window方法代码示例

本文整理汇总了Python中pyglet.window.Window方法的典型用法代码示例。如果您正苦于以下问题:Python window.Window方法的具体用法?Python window.Window怎么用?Python window.Window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyglet.window的用法示例。


在下文中一共展示了window.Window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_caption

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_caption(self):
        w1 = window.Window(400, 200, resizable=True)
        w2 = window.Window(400, 200, resizable=True)
        count = 1
        w1.set_caption('Window caption %d' % count)
        w2.set_caption(u'\u00bfHabla espa\u00f1ol?')
        last_time = time.time()
        while not (w1.has_exit or w2.has_exit):
            if time.time() - last_time > 1:
                count += 1
                w1.set_caption('Window caption %d' % count)
                last_time = time.time()
            w1.dispatch_events()
            w2.dispatch_events()
        w1.close()
        w2.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:18,代码来源:WINDOW_CAPTION.py

示例2: test_context_noshare_list

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_context_noshare_list(self):
        w1 = window.Window(200, 200)
        w1.switch_to()
        list = glGenLists(1)
        glNewList(list, GL_COMPILE)
        glLoadIdentity()
        glEndList()
        self.assertTrue(glIsList(list))

        w2 = window.Window(200, 200, context=self.create_context(None))
        w2.set_visible(True)
        w2.switch_to()
        self.assertTrue(not glIsList(list))

        w1.close()
        w2.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:18,代码来源:CONTEXT_SHARE.py

示例3: test_context_share_texture

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_context_share_texture(self):
        w1 = window.Window(200, 200)
        w1.switch_to()
        textures = c_uint()
        glGenTextures(1, byref(textures))
        texture = textures.value

        glBindTexture(GL_TEXTURE_2D, texture)
        data = (c_ubyte * 4)()
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
                     GL_UNSIGNED_BYTE, data)
        self.assertTrue(glIsTexture(texture))

        w2 = window.Window(200, 200)
        w2.switch_to()
        self.assertTrue(glIsTexture(texture))

        glDeleteTextures(1, byref(textures))
        self.assertTrue(not glIsTexture(texture))

        w1.switch_to()
        self.assertTrue(not glIsTexture(texture))

        w1.close()
        w2.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:27,代码来源:CONTEXT_SHARE.py

示例4: on_text

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def on_text(self, text):
        '''Handler for the `pyglet.window.Window.on_text` event.

        Caret keyboard handlers assume the layout always has keyboard focus.
        GUI toolkits should filter keyboard and text events by widget focus
        before invoking this handler.
        '''
        if self._mark is not None:
            self._delete_selection()

        text = text.replace('\r', '\n')
        pos = self._position
        self._position += len(text)
        self._layout.document.insert_text(pos, text, self._next_attributes)
        self._nudge()
        return event.EVENT_HANDLED 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:18,代码来源:caret.py

示例5: __init__

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def __init__(self, env, width, height):

        pw.Window.__init__(self, width=width, height=height, vsync=False, resizable=True)
        self.theta = 0
        self.still_open = True

        @self.event
        def on_close():
            self.still_open = False

        @self.event
        def on_resize(width, height):
            self.win_w = width
            self.win_h = height

        self.keys = {}
        self.human_pause = False
        self.human_done = False 
开发者ID:GOAL-Robots,项目名称:REALCompetitionStartingKit,代码行数:20,代码来源:test.py

示例6: setUp

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def setUp(self):
        self.w = window.Window(width=10, height=10)
        self.w.dispatch_events()
        resource.path.append('@' + __name__)
        resource.reindex() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:7,代码来源:RES_LOAD_IMAGE.py

示例7: open_window

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def open_window(self):
        return window.Window(200, 200, vsync=False) 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:4,代码来源:WINDOW_SET_VSYNC.py

示例8: test_method

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_method(self):
        win = window.Window()
        win.dispatch_events()

        win.push_handlers(self)
        win.set_fullscreen()
        self.check_sequence(0, 'begin')
        while not win.has_exit and not self.finished:
            win.dispatch_events()
            self.check_timeout()
        win.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:13,代码来源:EVENT_SEQUENCE_SET_FULLSCREEN.py

示例9: on_key_press

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def on_key_press(self, symbol, modifiers):
        if symbol == key.X:
            self.w.maximize()
            print 'Window maximized.'
        elif symbol == key.N:
            self.w.minimize()
            print 'Window minimized.' 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:9,代码来源:WINDOW_MINIMIZE_MAXIMIZE.py

示例10: test_minimize_maximize

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_minimize_maximize(self):
        self.width, self.height = 200, 200
        self.w = w = window.Window(self.width, self.height, resizable=True)
        w.push_handlers(self)
        while not w.has_exit:
            w.dispatch_events()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:9,代码来源:WINDOW_MINIMIZE_MAXIMIZE.py

示例11: test_move

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_move(self):
        w = window.Window(200, 200)
        w.push_handlers(self)
        while not w.has_exit:
            w.dispatch_events()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:8,代码来源:EVENT_MOVE.py

示例12: test_motion

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_motion(self):
        w = window.Window(200, 200)
        w.push_handlers(self)
        while not w.has_exit:
            w.dispatch_events()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:8,代码来源:EVENT_MOUSE_MOTION.py

示例13: test_resizable

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_resizable(self):
        self.width, self.height = 200, 200
        self.w = w = window.Window(self.width, self.height, resizable=True)
        glClearColor(1, 1, 1, 1)
        while not w.has_exit:
            w.dispatch_events()
            window_util.draw_client_border(w)
            w.flip()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:11,代码来源:WINDOW_RESIZABLE.py

示例14: test_style_borderless

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_style_borderless(self):
        self.width, self.height = 200, 200
        self.w = w = window.Window(self.width, self.height, 
                                   style=window.Window.WINDOW_STYLE_BORDERLESS)
        @w.event
        def on_mouse_press(*args): w.has_exit = True

        glClearColor(1, 1, 1, 1)
        while not w.has_exit:
            glClear(GL_COLOR_BUFFER_BIT)
            w.dispatch_events()
            w.flip()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:15,代码来源:WINDOW_STYLE_BORDERLESS.py

示例15: test_mouse_drag

# 需要导入模块: from pyglet import window [as 别名]
# 或者: from pyglet.window import Window [as 别名]
def test_mouse_drag(self):
        w = window.Window(200, 200)
        w.push_handlers(WindowEventLogger())
        while not w.has_exit:
            w.dispatch_events()
        w.close() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:8,代码来源:EVENT_MOUSE_DRAG.py


注:本文中的pyglet.window.Window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。