Setting up the GUI in OOP

The text editor we developed in the previous chapter was implemented in procedural code. Although it offered some benefits for quick coding, it had some typical limitations:

  • We started encountering global variables
  • The function definitions needed to be defined above the code that called them
  • Most importantly, the code was not reusable

Therefore, we need some way to ensure that our code is reusable. This is why programmers prefer to use object-oriented programming (OOP) to organize their code into classes.

OOP is a programming paradigm that shifts the focus onto the objects we want to manipulate rather than the logic required to manipulate them. This is in contrast to procedural programming, which views a program ...

Get Tkinter GUI Application Development Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.