Hi all,
I'm trying to modify the copied clipboard content from a wx.TextCtrl,
but I encountered some problems.
The content is richtext (bold, italic, font colours ...) and I'd like
to add some additional informations besides the selected text (e.g.
references of the text position).
Curently I am able to set the plain text to clipboard using a modified
example on http://wiki.wxpython.org/ClipBoard
do = wx.TextDataObject()
do.SetText(selected_text_with_added_references)
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(do)
wx.TheClipboard.Close()
...
However, I cannot find a way to work with the native richtext
clipboard this way. Is it somehow possible to retain the richtext
information of the clipboard and append some text to it, so that the
whole can be pasted to any rtf editor?
Or alternatively, is it at least possible to re-call the native copy
functionality of TextCtrl?
I replaced the context native menu with a custom one; can the native
copy item be added to this context menu somehow?
Currently I have to use a custom context menu to copy the selection as
plain text with added text references, or a shortcut Ctrl+C to copy
the richtext without those extra information.
Can this be unified somehow or at least made both available in the
replaced context menu?
(I'm currently working on win XP, but the code should be cross
platform, if possible.)
Hi all,
I'm trying to modify the copied clipboard content from a wx.TextCtrl,
but I encountered some problems.
The content is richtext (bold, italic, font colours ...) and I'd like
to add some additional informations besides the selected text (e.g.
references of the text position).
Curently I am able to set the plain text to clipboard using a modified
example on ClipBoard - wxPyWiki
do = wx.TextDataObject()
do.SetText(selected_text_with_added_references)
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(do)
wx.TheClipboard.Close()
...
However, I cannot find a way to work with the native richtext
clipboard this way. Is it somehow possible to retain the richtext
information of the clipboard and append some text to it, so that the
whole can be pasted to any rtf editor?
You'll probably need to bypass wx and use the Windows clipboard APIs via ctypes or PyWin.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Hi all,
I'm trying to modify the copied clipboard content from a wx.TextCtrl,
but I encountered some problems.
The content is richtext (bold, italic, font colours ...)
...
Is it somehow possible to retain the richtext
information of the clipboard and append some text to it, so that the
whole can be pasted to any rtf editor?
You'll probably need to bypass wx and use the Windows clipboard APIs via
ctypes or PyWin.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Hi Robin, thanks for the info;
I guess, in this case I can live with parallel native richtext
clipboard along with the enhanced plain one, instead of combining both
(currently I have a single code for windows and linux and would rather
like to keep it that way).
Would adding the original context menu item as a next function to the
custom menu also require ctypes etc. or is it exposed in some simpler
way?