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

8. Working with Events

Mike Driscoll
(1)
Ankeny, New York, USA
 

Recipe 8-1. Binding Multiple Widgets to the Same Handler

Problem

From time to time, you will find that you need to have multiple buttons call the same event handler. Usually this happens when you have more than one button that does very similar things. Other times, you’ll want to bind a Close button and a Close menu item to the same event handler so you don’t have multiple functions that do the same thing. This followd the Don’t Repeat Yourself (DRY) Principle .

Solution

A459092_1_En_8_Fig1_HTML.jpg
Figure 8-1
Binding multiple ...

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.