""" Author: Scott Mallory eMail: sm@ebbyfish.com wSite: www.ebbyfish.com """ from PythonCard import model class DBTable(model.Background): """ This is nothing more than a holder for a database Table. All of the fuctions will be controlled by the parent. """ def on_initialize(self, event): self.parent = self.getParent() #self.setTable(col, rows) def on_close(self, event): #self.doExit() self.visible = False def on_menuFileExit_select(self, event): self.close() def setMyTable(self, col, rows): """This sets up a pseudo database table and cast the first index as a string. It displays ALL records in tow tables (so size might matter). The rows arg is a List of Tuples [(),(),(),(),etc...]. This Grid like Tuples. This function takes care of that. """ # This MultiColumn list does not like single rows (horizontitally at least) # nor does it like integers in the first index...the 'for .. in ..' loop corrects for that. # # I am sure there is a better way to do this, but at this writing, I do not know how... rr = [] for s in rows: ts = list(s) # make the tuple a list ts[0] = str(ts[0]) # string the first index (I know it's an int) rs = tuple(ts) # back to a tuple rr.append(rs) # rebuild the list tuple(rr) # make everything a tuple self.components.List1.columnHeadings = col self.components.List1.items = rr if __name__ == '__main__': app = model.Application(DBTable) app.MainLoop()