import wx
t1_text = "this is a test"
t2_text = "this is another test"
class MyFrame(wx.Frame):
def __init__(self):
data = wx.TextDataObject()
data.SetText("asdf")
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(data)
wx.TheClipboard.Close()
else:
wx.MessageBox("Unable to open the clipboard", "Error")
success = False
data = wx.TextDataObject()
if wx.TheClipboard.Open():
success = wx.TheClipboard.GetData(data)
wx.TheClipboard.Close()
if success:
print data.GetText()
else:
wx.MessageBox("no data in the clipboard in the required format","Error")
app = wx.PySimpleApp()
frm = MyFrame()
app.MainLoop()