как я могу создать текстовый редактор html для вставки элементов древовидной структуры, тегов css вверху, html внизу - PullRequest
0 голосов
/ 09 мая 2020
# #here is the code in Linux platform

from tkinter import *
from tkinter.ttk import Treeview

root=Tk()

# ## the function call is where I need help. the CSS should be at the top position while the HTML below with the insertion cursor between I example(< h1>|< /h1>).

def click(event):

    text.insert(3.0,tree.selection())

text=Text(root )
text.pack(side="right") 
tree=Treeview(root)
tree.pack(side="left")
tree.insert("","0","CSS",text="CSS")
tree.insert("","1","#p{background: red}",text="background")
tree.insert("","2","< h1 id="p">< /h1>",text="p tag")
tree.item("CSS",open=True)
tree.item("CSS", "open")
tree.detach("#p{background:red}")
tree.detach("< h1 id="p">< /h1>")
tree.move("#p{background:red}","CSS","0")
tree.move("< h1 id="p">< /h1>","CSS","0")

# #bind each selection
tree.bind("<< TreeviewSelect>>", click)

root.mainloop()
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...