diff --git a/docs/source/info/features/index.rst b/docs/source/info/features/index.rst index 957308f0..bfdc0ecd 100644 --- a/docs/source/info/features/index.rst +++ b/docs/source/info/features/index.rst @@ -31,9 +31,9 @@ Main features * Input/Mouse/Paste Event handling -* Drag and Drop +* :ref:`Drag and Drop ` -* Clipboard support +* :ref:`Clipboard` support * Drawing primitives diff --git a/docs/source/info/resources/clipboard.rst b/docs/source/info/resources/clipboard.rst index 2fd9f957..54b42c43 100644 --- a/docs/source/info/resources/clipboard.rst +++ b/docs/source/info/resources/clipboard.rst @@ -1 +1,62 @@ -TBD \ No newline at end of file +.. _clipboard: + +========= +Clipboard +========= + +.. _pyTermTk: https://github.com/ceccopierangiolieugenio/pyTermTk + + +pyTermTk_ include a clipboard wrapper :class:`~TermTk.TTkGui.clipboard.TTkClipboard`, around any of the following libraries: + +- `copykitten `_ - Robust, dependency-free way to use the system clipboard in Python. +- `pyperclip `_ - Python module for cross-platform clipboard functions. +- `pyperclip3 `_ / `pyclip `_ - Cross-platform Clipboard module for Python with binary support. +- `clipboard `_ - A cross platform clipboard operation library of Python. Works for Windows, Mac and Linux. + +.. raw:: html + + + +The basic pyTermTk_ does not include any of those clipboard managers. +An internal implementation whitin the scope of the app itself is still available. + +If any of the previous listed clipboard managers are installed, pyTermTk_ is able to automatically detect and use them. + +i.e. + +.. code:: bash + + # Assuming no clipboard managers are installed + # you can still copy/paste between editors in this session + # but no text is copied to/from the system clipboard + python3 demo/showcase/textedit.py + + # if pyperclip is installed, + # pyTermTk defaults the clipboard manager to this tool + # any copy/paste is synced with the system clipboard + # it is possible to copy/paste from/to an external editor + pip install pyperclip + python3 demo/showcase/textedit.py + +----- +Usage +----- + +Once initialized the clipboard manager, 2 apis are provided that can be used to access the clipboard (:class:`~TermTk.TTkGui.clipboard.TTkClipboard.setText`, :class:`~TermTk.TTkGui.clipboard.TTkClipboard.text`) + + .. code:: python + + from TermTk import TTkClipboard + + # Initialize the clipboard manager + clipboard = TTkClipboard() + + # Push some text to the clipboard + clipboard.setText("Example") + + # Get the text from the clipboard + text = clipboard.text() \ No newline at end of file diff --git a/docs/source/info/resources/dragdrop.rst b/docs/source/info/resources/dragdrop.rst index 2fd9f957..90ce027f 100644 --- a/docs/source/info/resources/dragdrop.rst +++ b/docs/source/info/resources/dragdrop.rst @@ -1 +1,7 @@ +.. _DnD: + +============= +Drag and Drop +============= + TBD \ No newline at end of file diff --git a/docs/source/info/resources/index.rst b/docs/source/info/resources/index.rst index 1f19488a..7313e546 100644 --- a/docs/source/info/resources/index.rst +++ b/docs/source/info/resources/index.rst @@ -6,4 +6,6 @@ Resources :maxdepth: 1 :hidden: - modal \ No newline at end of file + clipboard + modal + dragdrop \ No newline at end of file