當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。