Begin renderer

This commit is contained in:
Romain de Laage 2020-12-04 09:51:55 +01:00
parent 03e7a0abfc
commit 9c83fa873a
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
1 changed files with 35 additions and 0 deletions

35
renderEngine.py Normal file
View File

@ -0,0 +1,35 @@
import tkinter as tk
def myTest(test):
print("coucou")
print(test)
class Renderer():
def __init__(self, parent):
self.parent = parent
self.content = tk.Text(self.parent)
self.currX = 0
self.currY = 1
self.addNormalText("test")
self.addLink("mylink")
self.addNormalText("test2")
self.addLink("mylink2")
self.content['state'] = 'disabled'
self.content.pack()
def addNormalText(self, text):
self.content.insert(str(self.currY)+'.'+str(self.currX), text+"\n")
self.currY+=1
def addLink(self, text):
index1 = str(self.currY)+'.'+str(self.currX)
self.content.tag_bind("link-"+index1, "<Button-1>", lambda event, url=text:
print(url))
self.content.insert(index1, text+"\n")
self.content.tag_add("link-"+index1, index1, str(self.currY)+'.'+str(self.currX+len(text)))
self.currY+=1
app = tk.Tk()
app.title("Test")
render = Renderer(app)
app.mainloop()