kaiseroskilo
kaiseroskilo

Reputation: 1729

GUI for database tables with pygtk and glade

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.

Upvotes: 3

Views: 2200

Answers (1)

jcollado
jcollado

Reputation: 40414

Given that the number and name of the columns to display isn't known beforehand, you could just create a gtk.TreeView widget 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_model and the columns could be adapted to match the information to be dsplayed with the gtk.TreeView.{append,remove,insert}_column columns.

Regarding the model, you coud create a new gtk.ListStore with appropriate columns depending on the results from the database.

I hope this helps.

Upvotes: 3

Related Questions