Based on the link suggested by @chrki.
You can do this:
- Install HtmlClipboard : copy the script, save it as
HtmlClipboard.py
in C:\Python##\Lib\site-packages\
- Save the script below as
link_as_html.py
(I used some of your code in your question):
- Create a shorcut for the script in step to (right click on the file
link_as_html.py
, and select create a shorcut)
- Right click on the shorcut, select
Properties
, and and add a keyboard shorcut in Shorcut key.
That's it. When you have an link in our clipboard, you can just press your keyboard shorcut and you can paste your image directly in the html mode of you editor.
link_as_html.py (Python34). I assume you have your url http://www.web.com
in the clipboard:
from tkinter import Tk
root = Tk()
root.withdraw()
url = root.clipboard_get()
# send <a href="http://www.web.com" target="_blank">my link</a> to an "HTML format clipboard"
import HtmlClipboard
HtmlClipboard.PutHtml("<a href=\"http://"+url+" \" target=\"_blank\"/>my link</a>")