Populating Tcl Treeview with Sqlite Data

Posted by DFM on Stack Overflow See other posts from Stack Overflow or by DFM
Published on 2009-09-15T14:08:42Z Indexed on 2010/04/01 0:03 UTC
Read the original article Hit count: 1046

Filed under:
|
|
|

Hello:

I am building a Tcl application that reads off of a Sqlite Db. Currently, I can enter data into the database using the Tcl frontend. Now, I am trying to figure out how to display the data within the Sqlite Db from the Tcl frontend.

After a little bit of research, I found that the treeview widget would work well for my needs. I now have the following code:

set z1 [ttk::treeview .c1.t1 -columns {1 2} -show headings] $z1 heading #1 -text "First Name" $z1 heading #2 -text "Last Name"

proc Srch {} {global z1 sqlite3 db test.db pack $z1 db close }

When the "Srch" procedure is executed (button event), the treeview (z1) appears with the headings First Name and Last Name. Additionally, the Sqlite Db gets connected, then closes.

I wanted to add code that would populate the treeview from the Sqlite Db between connecting to the Db and packing the treeview (z1). Does anyone know the correct syntax to populate a Tcl treeview with data from Sqlite?

Thank you everyone in advance,

DFM

© Stack Overflow or respective owner

Related posts about tcl

Related posts about treeview