New style for link

This commit is contained in:
Romain de Laage 2020-12-04 10:02:39 +01:00
parent 9c83fa873a
commit 029889966f
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
1 changed files with 3 additions and 4 deletions

View File

@ -1,12 +1,10 @@
import tkinter as tk
def myTest(test):
print("coucou")
print(test)
import tkinter.font as tkFont
class Renderer():
def __init__(self, parent):
self.parent = parent
self.underlineFont = tkFont.Font(underline=1)
self.content = tk.Text(self.parent)
self.currX = 0
self.currY = 1
@ -23,6 +21,7 @@ class Renderer():
def addLink(self, text):
index1 = str(self.currY)+'.'+str(self.currX)
self.content.tag_config("link-"+index1, foreground="#00f", font=self.underlineFont)
self.content.tag_bind("link-"+index1, "<Button-1>", lambda event, url=text:
print(url))
self.content.insert(index1, text+"\n")