I am fetching a number of records from postgres using python tkinter and displaying the same on an layout , the code which I am using for fetching and listing using listbox is as below :
def get_search(id):
conn = psycopg2.connect(dbname="postgres", user="postgres", password="passw0rd", host="localhost", port="5432")
cur = conn.cursor()
query = 'select * from table where id=%s;'
cur.execute(query, (id,))
row = cur.fetchall()
listbox = Listbox(frame, width=20, height=1)
listbox.grid(row=9, column=1)
listbox.insert(END, row)
listbox = Listbox(frame, width=20, height=10)
listbox.grid(row=9, column=1)
for x in row:
listbox.insert(END, x)
conn.commit()
conn.close()
However, the data which is displaying is just plain simple and blank space is as delimiter. Is it feasible to add further in listbox or using something else so that either each column for each row shows separately in individual box or the column values can be separated by a different delimiter.