Fix canvas windows size regarding scrollbars.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-23 20:24:18 +02:00
parent e6e0951029
commit 9c03910420

View File

@ -43,6 +43,7 @@ class GuiWindow(wx.ScrolledWindow):
def resize(self, newSize): def resize(self, newSize):
self.size = newSize; self._updateScrollBars(); self.size = newSize; self._updateScrollBars();
self.SetMinSize(self.size); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.size); self.SetMinSize(self.size); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.size);
self.SetMinSize(self.parent.GetSize()); self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *self.parent.GetSize())
curWindow = self curWindow = self
while curWindow != None: while curWindow != None:
curWindow.Layout(); curWindow = curWindow.GetParent(); curWindow.Layout(); curWindow = curWindow.GetParent();
@ -51,6 +52,7 @@ class GuiWindow(wx.ScrolledWindow):
# __init__(self, parent, pos, scrollStep, style=0): initialisation method # __init__(self, parent, pos, scrollStep, style=0): initialisation method
def __init__(self, parent, pos, scrollStep, style=0): def __init__(self, parent, pos, scrollStep, style=0):
super().__init__(parent, pos=pos, style=style) if style != 0 else super().__init__(parent, pos=pos) super().__init__(parent, pos=pos, style=style) if style != 0 else super().__init__(parent, pos=pos)
self.parent = parent
self.pos, self.scrollFlag, self.scrollStep, self.size = pos, False, scrollStep, None self.pos, self.scrollFlag, self.scrollStep, self.size = pos, False, scrollStep, None
for eventType, f in ( for eventType, f in (
(wx.EVT_CHAR, self.onKeyboardInput), (wx.EVT_CLOSE, self.onClose), (wx.EVT_ENTER_WINDOW, self.onEnterWindow), (wx.EVT_CHAR, self.onKeyboardInput), (wx.EVT_CLOSE, self.onClose), (wx.EVT_ENTER_WINDOW, self.onEnterWindow),