Re: wx.Theclipboard
David Woods <[email protected]> Mon, 8 Jan 2024 10:56:10 -0600
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
Hi Nathan, Your request is not a small ask, and I don't have time to write=20 something new and custom and targeted to your specific situation. If you want an example of using the Clipboard with complex data, take a=20 look at https://github.com/DKWoods/PyParserDemo, starting with the=20 PyParserDemo.py file's OnCutCopy() and OnPaste() methods, which handle=20 transferring formatted text between a wxPython app and a word=20 processor.=C2=A0 It uses wx.DataObjectComposite() to pass both formatted an= d=20 plain text versions of the data being passed through the clipboard.=C2=A0 I= n=20 OnPaste(), you can see the code attempt to find formatted text and if=20 that fails, to use plain text. To run my code, which demonstrates DOCx and RTF support for the wxPython=20 RichTextCtrl, you will need to install the python-docx module fork from=20 my repository as well as wxPython. Hope that helps. David On 1/8/24 6:39 AM, Nathan smith wrote: > Hello, > > > Would someone mind awfully writing me an example script ath shows me=20 > how to copy multiple formats to the clipboard and paste/ > > What I want to achieve here is: > > I have one object that is plane text, > > and another object that is bytes. > > I want basically to be able to set the clipboard with both formats,=20 > then in the paste function say if the plain text is present, set that=20 > to a variable, if the bytes format is present, use that too. > > > Thanks in advance, > > Nathan > --=20 You received this message because you are subscribed to the Google Groups "= wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/= wxpython-users/51b806d5-ad53-4221-aa6c-687625dae127%40gmail.com.