def __init__(self, textwidget, filetype_name_getter):
self.textwidget = textwidget
self._get_filetype_name = filetype_name_getter
self.pygmentizer = PygmentizerProcess()
# the tags use fonts from here
self._fonts = {}
for bold in (True, False):
for italic in (True, False):
# the fonts will be updated later, see _on_config_changed()
self._fonts[(bold, italic)] = tkfont.Font(
weight=('bold' if bold else 'normal'),
slant=('italic' if italic else 'roman'))
config.connect('pygments_style', self._on_config_changed)
config.connect('font_family', self._on_config_changed)
config.connect('font_size', self._on_config_changed)
self._on_config_changed()
self.textwidget.after(50, self._do_highlights)
评论列表
文章目录