From f0e0d80dd8917b051ffa3e63a6dff954edb7596b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 12 Apr 2019 15:48:34 -0700 Subject: [PATCH] workaround bad default size of wx.SearchCtrl on gtk3 (cherry picked from commit 1d1f4f712add8ee00f30e18539ef04e6baf00fd2) --- demo/Main.py | 8 ++++++++ demo/SearchCtrl.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/demo/Main.py b/demo/Main.py index 00fcffb8..5469a59b 100644 --- a/demo/Main.py +++ b/demo/Main.py @@ -1493,6 +1493,14 @@ class wxPythonDemo(wx.Frame): lambda e: self.filter.SetValue('')) self.filter.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) + if 'gtk3' in wx.PlatformInfo: + # Something is wrong with the bestsize of the SearchCtrl, so for now + # let's set it based on the size of a TextCtrl. + txt = wx.TextCtrl(leftPanel) + bs = txt.GetBestSize() + txt.DestroyLater() + self.filter.SetMinSize((-1, bs.height+4)) + searchMenu = wx.Menu() item = searchMenu.AppendRadioItem(-1, "Sample Name") self.Bind(wx.EVT_MENU, self.OnSearchMenu, item) diff --git a/demo/SearchCtrl.py b/demo/SearchCtrl.py index 115c8c41..8a4e12b7 100644 --- a/demo/SearchCtrl.py +++ b/demo/SearchCtrl.py @@ -18,6 +18,14 @@ class TestPanel(wx.Panel): self.search = wx.SearchCtrl(self, size=(200,-1), style=wx.TE_PROCESS_ENTER) + if 'gtk3' in wx.PlatformInfo: + # Something is wrong with the bestsize of the SearchCtrl, so for now + # let's set it based on the size of a TextCtrl. + txt = wx.TextCtrl(self) + bs = txt.GetBestSize() + txt.DestroyLater() + self.search.SetMinSize((200, bs.height+4)) + # Setup the layout box = wx.StaticBoxSizer(sb, wx.VERTICAL) box.Add(searchBtnOpt, 0, wx.ALL, 5)