From 153ffacf7c397b6815c7a2317484c6897f78d51f Mon Sep 17 00:00:00 2001 From: "Edwin Marshall (aspidites)" Date: Tue, 17 Jul 2012 10:52:38 -0700 Subject: [PATCH] - now possible to set a window's size at runtime (respects rotation) --- kivy/core/window/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kivy/core/window/__init__.py b/kivy/core/window/__init__.py index 201f5e360..cee1d3e53 100755 --- a/kivy/core/window/__init__.py +++ b/kivy/core/window/__init__.py @@ -250,17 +250,22 @@ class WindowBase(EventDispatcher): def _get_size(self): r = self._rotation w, h = self._size - if r == 0 or r == 180: + if r in (0, 180): return w, h return h, w def _set_size(self, size): - if super(WindowBase, self)._set_size(size): - Logger.debug('Window: Resize window to %s' % str(self.size)) + if self._size != size: + r = self._rotation + if r in (0, 180): + self._size = size + else: + self._size = size[1], size[0] + self.dispatch('on_resize', *size) return True - return False - + else: + return False size = AliasProperty(_get_size, _set_size) '''Get the rotated size of the window. If :data:`rotation` is set, then the size will change to reflect the rotation.