I’m building a database front-end with python and glade. I need to present SQL query results in the form of database tables inside my app’s window (schema followed by tuples/records). Both the schema and the database entries are dynamic because the schema could be that of a join operation or in general altered and the number of tuples could be any valid number.One possible solution could be to format a given table with python, create a text object in my GUI and change its’ value to that produced by python. Advices and suggestions are very welcome.
Share
Given that the number and name of the columns to display isn’t known beforehand, you could just create a
gtk.TreeViewwidget in glade and modify it as you need in the application code.This widget could be updated to use a new model using
gtk.TreeView.set_modeland the columns could be adapted to match the information to be dsplayed with thegtk.TreeView.{append,remove,insert}_columncolumns.Regarding the model, you coud create a new
gtk.ListStorewith appropriate columns depending on the results from the database.I hope this helps.