-
Book Overview & Buying
-
Table Of Contents
wxPython Application Development Cookbook
By :
For most usages of the grid control, your application must define a custom data source to provide the data on demand when the grid requests to display it. The use of a data source allows virtualizing data storage to prevent duplicating the storage of data in both the control and the backing data field. In this recipe, we will take a look at how to create a custom PyGridTableBase to use as a data source for grid.
Perform the following steps:
First, in this recipe, we will retrieve backing data from the GitHub API, so we need to import a few extra modules from the Python standard library. We will do this as follows:
import urllib import json import wx import wx.grid as gridlib
Let's start by defining the custom PyGridTableBase class to provide data to the grid:
class MyDataSource(gridlib.PyGridTableBase):
def __init__(self):
super(MyDataSource, self).__init__()
# Github change history for wxPython
self._RetrieveData()...
Change the font size
Change margin width
Change background colour