def create_path(self, path, name):
# If the user is running Windows ...
if hasattr(os, 'startfile'):
# Create a new tag for the path.
self.__path_id += 1
tag = 'path' + str(self.__path_id)
# Add the text and create an opening command.
self.__text.insert(tkinter.END, name, ('dynamic_link', tag))
self.__text.tag_bind(tag, '<1>', lambda event: os.startfile(path))
else:
# Insert a link that does not do anything.
self.__text.insert(tkinter.END, name, 'static_link')
评论列表
文章目录