-
Book Overview & Buying
-
Table Of Contents
wxPython Application Development Cookbook
By :
If you need to display a list of some data but would like more control over how it looks, the VListBox control provides an interface to create an owner-drawn ListBox-like control. This control works by providing a number of pure virtual callback methods that you must override in your subclass in order to draw the list of items on demand. In this recipe, we will see how to create our own custom list of controls using VListBox.
Here are the steps that you need to perform:
First, we will start by creating a simple little data class to hold information about the custom list of items that we will create a display for, as follows:
import wx
class UserInfo(object):
def __init__(self, name, email):
super(UserInfo, self).__init__()
self.name = name
self.email = emailNext, we will start declaring our custom list box control that will be used to display this data using the following code:
class UserListBox(wx.VListBox):
def __init__...
Change the font size
Change margin width
Change background colour