diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ComboCtrl.SetMainControl.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ComboCtrl.SetMainControl.1.py new file mode 100644 index 00000000..69eb1539 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ComboCtrl.SetMainControl.1.py @@ -0,0 +1,17 @@ + + # Create the combo control using its default ctor. + combo = wx.ComboCtrl() + + # Create the custom main control using its default ctor too. + someMainWindow = SomeWindow() + + # Set the custom main control before creating the combo. + combo.SetMainControl(someMainWindow) + + # And only create it now: wx.TextCtrl won't be unnecessarily + # created because the combo already has a main window. + combo.Create(panel, wx.ID_ANY, wx.EmptyString) + + # Finally create the main window itself, now that its parent was + # created. + someMainWindow.Create(combo, ...) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.1.py new file mode 100644 index 00000000..ed54d88d --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.1.py @@ -0,0 +1,12 @@ + + listctrl = wx.ListCtrl(...) + for i in range(3): + listctrl.InsertColumn(i, wx.String.Format("Column %d", i)) + + order = [ 2, 0, 1] + listctrl.SetColumnsOrder(order) + + # Now listctrl.GetColumnsOrder() will return order and + # listctrl.GetColumnIndexFromOrder(n) will return order[n] and + # listctrl.GetColumnOrder() will return 1, 2 and 0 for the column 0, 1 and 2 + # respectively. diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.GetUpdatedAscendingSortIndicator.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.GetUpdatedAscendingSortIndicator.1.py new file mode 100644 index 00000000..7873deec --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ListCtrl.GetUpdatedAscendingSortIndicator.1.py @@ -0,0 +1,9 @@ + + def OnColClick(self, event): + col = event.GetColumn() + if col == -1: + return # clicked outside any column. + + ascending = self.GetUpdatedAscendingSortIndicator(col) + self.SortItems(self.MyCompareFunction, ascending) + self.ShowSortIndicator(col, ascending) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Sizer.SetSizeHints.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Sizer.SetSizeHints.1.py new file mode 100644 index 00000000..9959062b --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Sizer.SetSizeHints.1.py @@ -0,0 +1,12 @@ + + # In a frame's __init__ + ... + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(...) + sizer.Add(...) + panel.SetSizer(sizer) + + # Use the panel sizer to set the initial and minimal size of the + # frame to fit its contents. + sizer.SetSizeHints(self) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.IsBackendAvailable.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.IsBackendAvailable.1.py new file mode 100644 index 00000000..e71e5a17 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.IsBackendAvailable.1.py @@ -0,0 +1,3 @@ + + if wx.html2.WebView.IsBackendAvailable(wx.html2.WebViewBackendEdge): + # Do whatever you need to do when the Edge backend is available diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.xrc.XmlResource.LoadDocument.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.xrc.XmlResource.LoadDocument.1.py new file mode 100644 index 00000000..565c2c1f --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.xrc.XmlResource.LoadDocument.1.py @@ -0,0 +1,12 @@ + + xrc_data = ... # Retrieve it from wherever. + xmlDoc = wx.xml.XmlDocument(io.BytesIO(xrc_data)) + if not xmlDoc.IsOk(): + ... handle invalid XML here ... + return + + if not wx.XmlResource.Get().LoadDocument(xmlDoc): + ... handle invalid XRC here ... + return + + ... use the just loaded XRC as usual ...