© Mike Driscoll 2018
Mike DriscollwxPython Recipeshttps://doi.org/10.1007/978-1-4842-3237-8_12

12. Fun with Panels

Mike Driscoll
(1)
Ankeny, New York, USA
 

Recipe 12-1. Making a Panel Self-Destruct

Problem

A few years ago I saw a question on the popular StackOverflow web site asking how to dynamically destroy and create panels after a certain amount of time has passed. It was such an interesting idea that I decided to go ahead and write about how to do it. All you really need is a wx.Timer and the panel object. For this piece of code, I used a panel that displays a countdown with a wx.StaticText widget , destroys itself, and is promptly replaced with another panel.

Solution

Let’s take a look at the following code to do this little piece of magic: ...

Get wxPython Recipes: A Problem - Solution Approach 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.