def set_frame(self, rect): if ( self._resizable == False and (rect.size.width != None or rect.size.height != None)): raise ValueError(u'Window is not resizable') View.set_frame(self, rect) self._pyglet.set_location(self._frame.origin.x, self._frame.origin.y) self._pyglet.set_size(self._frame.size.width, self._frame.size.height)
def __init__(self, style=STYLE_DEFAULT, fixed_size=None): View.__init__(self) self._window = self self._first_responder = None self._title = None self._style = style self._resizable = fixed_size is None self._application = Application.shared_application() self._min_size = None self._max_size = None self._zoomed = False self._key_window = False self._main_window = False if fixed_size is None: # normal window self._pyglet = PygletWindow(self, style=style, resizable=True) else: # fixed size window self._pyglet = PygletWindow(self, style=style, resizable=False, width=fixed_size.width, height=fixed_size.height) x, y = self._pyglet.get_location() width, height = self._pyglet.get_size() View.set_frame(self, Rect(x, y, width, height)) self._application._add_window(self)
def on_resize(self, width, height): pyglet.window.Window.on_resize(self, width, height) View.set_frame(self._window, Rect(width=width, height=height))
def on_move(self, x, y): View.set_frame(self._window, Rect(x=x, y=y))