diff --git a/youtube_dl_gui/optionsframe.py b/youtube_dl_gui/optionsframe.py index b027c80..99408fd 100644 --- a/youtube_dl_gui/optionsframe.py +++ b/youtube_dl_gui/optionsframe.py @@ -62,6 +62,8 @@ class OptionsFrame(wx.Frame): if self.app_icon is not None: self.SetIcon(self.app_icon) + self._was_shown = False + # Create GUI panel = wx.Panel(self) notebook = wx.Notebook(panel) @@ -123,6 +125,14 @@ class OptionsFrame(wx.Frame): for tab, _ in self.tabs: tab.save_options() + def Show(self, *args, **kwargs): + # CenterOnParent can't go to main frame's __init__ as main frame may change + # own position and options frame won't be centered on main frame anymore. + if not self._was_shown: + self._was_shown = True + self.CenterOnParent() + return wx.Frame.Show(self, *args, **kwargs) + class TabPanel(wx.Panel):