diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Clipboard.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Clipboard.1.py index 9955a8cd..3a9706ba 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Clipboard.1.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Clipboard.1.py @@ -1,20 +1,19 @@ # Write some text to the clipboard if wx.TheClipboard.Open(): - - # This data objects are held by the clipboard, - # so do not delete them in the app. wx.TheClipboard.SetData(wx.TextDataObject("Some text")) wx.TheClipboard.Close() + + # Test if text content is available + not_empty = wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_TEXT)) + + # Read some text + text_data = wx.TextDataObject() if wx.TheClipboard.Open(): - - if wx.TheClipboard.IsSupported(wx.DF_TEXT): - - data = wx.TextDataObject() - wx.TheClipboard.GetData(data) - wx.MessageBox(data.GetText()) - + success = wx.TheClipboard.GetData(text_data) wx.TheClipboard.Close() + if success: + return text_data.GetText()