O'Reilly logo

Python GUI Programming Cookbook by Burkhard A. Meier

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

How to create independent message boxes

In this recipe, we will create our tkinter message boxes as stand-alone top-level GUI windows.

We will first notice that, by doing so, we end up with an extra window so we will explore ways to hide this window.

In the previous recipe, we invoked tkinter message boxes via our Help | About menu from our main GUI form.

So why would we wish to create an independent message box?

One reason is that we might customize our message boxes and reuse them in several of our GUIs. Instead of having to copy and paste the same code into every Python GUI we design, we can factor it out of our main GUI code. This can create a small reusable component, which we can then import into different Python GUIs.

Getting ready

We have already ...

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