H
H
Haku_Sempai2021-03-23 00:00:03
Python
Haku_Sempai, 2021-03-23 00:00:03

How to link list and db in PyQt5?

I'm making a classifier for myself, as I have for the
time being 1. when you click on the create classification button, a window with settings flies out, so far only the name of the classification and the number of columns;
2. when creating, this name should get into a separate list, from where I plan to choose future classifications
. That is, the idea is that the name of the table (in sqlite) will be the name of the classification, so the question arises, how to make QListView read the database and issue list of tables (name).
Trying to output via cursor

conn = sqlite3.connect('mydb.db')
curs = conn.cursor()
curs.execute('SELECT name FROM sqlite_master WHERE type = "table";')
a = curs.fetchone()
print (a)

but how to make friends with the received information with Qlistview already the sleepy brain does not think out, thanks to everyone

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question