Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
wxPython Application Development Cookbook

You're reading from   wxPython Application Development Cookbook Over 80 step-by-step recipes to get you up to speed with building your own wxPython applications

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785287732
Length 264 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Cody Precord Cody Precord
Author Profile Icon Cody Precord
Cody Precord
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. wxPython Starting Points FREE CHAPTER 2. Common User Controls 3. UI Layout and Organization 4. Containers and Advanced Controls 5. Data Displays and Grids 6. Ways to Notify and Alert 7. Requesting and Retrieving Information 8. User Interface Primitives 9. Creating and Customizing Components 10. Getting Your Application Ready for Release Index

Recreating native controls with RendererNative


The RendererNative class is a drawing class that encapsulates and exposes routines for drawing parts of the native system's UI components. It provides high-level drawing functions that allow you to draw items such as a Button or CheckBox control in a DeviceContext without needing to know any of the details of how it is done. This is a powerful feature that can allow you to create your own custom widgets that still maintain a native look. In this recipe, we will recreate the CheckBox control to add support to align the label below the CheckBox control.

How to do it…

Perform the following:

  1. First, we will start with the constructor for our custom CheckBox control:

    class CustomCheckBox(wx.PyControl):
        def __init__(self, parent, label, style=0):
            style |= wx.NO_BORDER
            super(CustomCheckBox, self).__init__(parent,
                                                 style=style)
            self.Label = label
            self._value = False
            self...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image