1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2017
    Rep Power

    how to set value into tktable

    how can i set values (for example query result from sql) in a tktable????
    i don't understand meaning of the following lines

    self.table.set( str(r) + "," + str(c), str( col ))


    self.table.set('row', idx, col)

    please explain them
    ".set" is a function in TkTable.py

    i can fetchall my data from the database, but my tktable don't show my q

    a part of my code that gets data from sql table and then puts in the tktable, is:
    [[def fill_table( self, cur ):
            cur.execute("SELECT * FROM trunmanage")
            rows = cur.fetchall()
            r = 0
            for row in rows:
                c = 0
                for col in row:
                    self.table.set( str(r) + "," + str(c), str( col )
                    c = c + 1
                r = r + 1]]
    if you have another suggestion instead of tktable, please tell me
    i need a table so that i can get index of row & column of the selected row and also with "bind" attribute
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2009
    Rep Power
    I prefer MultiListBox at mhMultiListBox - Tkinter Wiki Running the program sets up an example listbox with headings and data. Also, take a look at the code and see what the buttons do.

IMN logo majestic logo threadwatch logo seochat tools logo