Summary

In this chapter, we have learned all about Tkinter's indexing system. We know how to structure an index, combining the line number and character number with a full stop character to create an index such as 3.15.

We then covered how this system is applied to provide greater functionality, including tags and searches.

Tags are Tkinter's way of adjusting the styling options of a certain range of text, marked by beginning and end indexes. We have seen a lot of different styling options which we can change using tags, including the text color, which allows us to achieve syntax highlighting. We know how to configure and remove tags as we need them.

Searching a Text widget using a loop is well-practiced. We know how to use Tkinter's special strings to very quickly create the ending indexes from the established beginning and length of the match. We can use these to apply tags or replace text with something else.

Along our journey, we also picked up some knowledge of YAML files and their syntax. We can now utilize YAML files to enable the user to adjust the styling of their syntax highlighting without having to dig into the underlying Python code at all.

Our text editor is now knowledgeable of the Python language, but why stop there? In the next chapter, we will be adding menus to our application. Along with the menus will come new functionalities, including the ability to load syntax for any language we wish to write a YAML file for. We will also be able to adjust the colors of our application window itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset