In the previous two recipes in this chapter, we looked at how to work with GridTableBase
to make a data source and considered some additional information about grid itself. In these previous examples, we worked with static data that was preloaded into the data table; however, in this recipe, we will work with a dynamic data source that can update grid dynamically when the data in the data source changes.
Perform the following steps for this recipe:
First, let's import all the libraries we will need for this recipe, which are as follows:
import os import stat import time import wx import wx.grid as gridlib
Next, let's start by making a little data class to help put information about a file in a human readable format:
class FileInfo: def __init__(self, path): self.path = path fstat = os.stat(path) ltime = time.localtime(fstat[stat.ST_MTIME]) self.modified = time.asctime(ltime) self.type = "Directory" if os.path.isdir...