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 - Python Tutorial
From the course: Rapid Application Development with Python
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.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Generate code for the app2m 30s
-
Add Excel sheetnames to a listbox3m 24s
-
Link an edit field to a data source3m 51s
-
Add event handlers in wxPython6m 48s
-
Complete the main tab sheet3m 17s
-
Build and using tree controls4m 28s
-
Link edit fields to the tree1m 44s
-
Save data into the worksheet1m 46s
-
Review Python RAD with wxGlade4m 32s
-
-