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.

Checkboxes and radio buttons

Checkboxes and radio buttons - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

Checkboxes and radio buttons

- [Instructor] Let's take a look at check boxes and radio buttons. I'll be using the wxTest program with the test button includes. Check boxes are used in the GUI to get a binary value, checked or not checked, such as enabling a user to set or unset an option. We can add one onto the panel by entering after line seven. Self dot and I'll call it cb_discount equals wx.CheckBox widget with a parent of the panel and a system-assigned object number. And we'll call the label of the checkbox Apply Discount. And I'll position it at 60, 20. At line 11, we can modify our test button event handler to display the state of the checkbox using the isChecked property of the widget. I'll comment out the original print. And we'll print Checkbox, self.cb_discount.IsChecked. And when we run this, we can check and uncheck the checkbox and we can use the Testing button to retrieve its state. Radio boxes provide a set of one or more…

Contents