From the course: Rapid Application Development with Python

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add event handlers in wxPython

Add event handlers in wxPython - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

Add event handlers in wxPython

- [Instructor] Let's now add some handler code to the active widgets. I'll start by introducing an event handler for the main tab add button. I select my add button, and at the bottom left, in the widget properties pane, I'll select events. wxGlade has populated the events tab with an event evt_button, and I'll call my event handler on_add_pressed. And I'll regenerate the source code. At line 48, I can see that there's now a binding between the event handler function I put in and the button widgets. When I scroll down the wxGlade code, I can see the new event handler function starting at line 138 with a print statement as a placeholder for event handling code. Let's replace this with some real event handling code. We'll take out the print statement in the on_add_pressed handler and add the handler code. I'll pick up the system name in the text control box, which is the name of the new system to add to the audit list.…

Contents