3

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.

kaiseroskilo
  • 1,719
  • 4
  • 21
  • 29
  • 2
    libgda has pre-built widgets for this. I don't know enough about it to know if they're what you want. – ptomato Feb 15 '12 at 21:28
  • That's a very nice library. Unfortunately I can't intergrate it to my project. Next time I'll use it for sure though.Thank you. – kaiseroskilo Feb 15 '12 at 22:31

1 Answers1

3

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.

jcollado
  • 39,419
  • 8
  • 102
  • 133