如何在Python IDLE中使用ColorDelegator?

时间:2016-02-04 19:03:32

标签: python-3.x tkinter syntax-highlighting python-idle python-3.5

我一直在开发一个用于Python的IDE,我一直想通过集成IDLE的colorDelegator模块来节省很多时间。

是否有可能使用它,我将如何去做? (使用tkinter文本小部件)。

1 个答案:

答案 0 :(得分:1)

这是ColorDelegator.py底部的示例:

def main():
    from idlelib.Percolator import Percolator
    root = Tk()
    root.wm_protocol("WM_DELETE_WINDOW", root.quit)
    text = Text(background="white")
    text.pack(expand=1, fill="both")
    text.focus_set()
    p = Percolator(text)
    d = ColorDelegator()
    p.insertfilter(d)
    root.mainloop()