O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginning our text editor

Before writing any code, be sure to make a new folder to hold the files for this chapter. Inside this folder, create a file called textarea.py. This file will hold the main part of our text editor—a subclass of the Text widget.

The Text widget is such as a textarea tag within HTML. It holds multiple lines of text and many formatting options. In the next chapter, we will see just how powerful this widget can be with the use of concepts like tags and indexing, which alter the text's appearance and give us control over certain regions of the text, allowing us to search all over the document within.

For now, we will just need a simple instance of the widget with a couple of configuration options set:

import tkinter  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required