Files
Phoenix/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Clipboard.1.py
Scott Talbert 2791fd7016 Use wx.DF_UNICODETEXT instead of wx.DF_TEXT
wx.DF_TEXT doesn't work on macOS and Unicode should be available under
all platforms.
2021-12-06 19:56:04 -05:00

20 lines
566 B
Python

# Write some text to the clipboard
if wx.TheClipboard.Open():
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_UNICODETEXT))
# Read some text
text_data = wx.TextDataObject()
if wx.TheClipboard.Open():
success = wx.TheClipboard.GetData(text_data)
wx.TheClipboard.Close()
if success:
return text_data.GetText()