def DoGetBestSize(self): # TODO: Ask sizer # Common case of no sizer and single child taking up the entire panel if len(self.GetChildren()) == 1: child = self.GetChildren()[0] dc = wx.ClientDC(self) return self._art.GetPanelSize(dc, self, wx.Size(*child.GetBestSize()), None) return wx.Size(*RibbonControl.DoGetBestSize(self))
def DoGetBestSize(self): """ Gets the size which best suits the window: for a control, it would be the minimal size which doesn't truncate the control, for a panel - the same size as it would have after a call to `Fit()`. :return: An instance of :class:`Size`. :note: Overridden from :class:`PyControl`. """ # Ask sizer if present if self.GetSizer(): dc = wx.ClientDC(self) return self._art.GetPanelSize(dc, self, wx.Size(*self.GetPanelSizerBestSize()), None) # Common case of no sizer and single child taking up the entire panel elif len(self.GetChildren()) == 1: child = self.GetChildren()[0] dc = wx.ClientDC(self) return self._art.GetPanelSize(dc, self, wx.Size(*child.GetBestSize()), None) return wx.Size(*RibbonControl.DoGetBestSize(self))