Jan-12-2020, 01:44 PM
Hello,
Please, how do I update a combobox so that after entering a data item I return it to the drop-down list without having to restart the form?
My Combobox :
Please, how do I update a combobox so that after entering a data item I return it to the drop-down list without having to restart the form?
My Combobox :
def cmb_theme(event=None): connexion = sqlite3.connect('mnesis.db') cursor = connexion.cursor() cursor.execute('SELECT theme_theme FROM tb_theme ORDER BY theme_theme') data = [] for row in cursor.fetchall(): data.append(row[0]) return dataMy function Save :
def save_theme(theme_theme): """ Insert in database """ try: connection = sqlite3.connect('mnesis.db') # Connection à la BdD cursor = connection.cursor() new_theme = (cursor.lastrowid, theme_theme) cursor.execute('INSERT INTO tb_theme VALUES(?,?)', new_theme) except Exception as e: print("ERREUR", e) connection.rollback() finally: cursor.close() connection.commit() connection.close() # Delete textbox after records entry_theme.delete('1.0', END)