work with Clipboard : Clipboard « wxPython « Python Tutorial






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()








19.5.Clipboard
19.5.1.work with Clipboard
19.5.2.how to put multiple objects in the clipboard