本文整理汇总了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()
示例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()
示例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()
示例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
示例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
示例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()
示例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)
示例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()
示例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.'
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()