Good morning,
I have a listbox and am having trouble storing the contents of this list in the Mysql database. Can anybody help me. I followed the code and error below:
def SaveVariosCodBr(self):
db=self.conexaoBanco()
cursor=db.cursor()
listcod = self.ListCodBrGer.get(ALL)
sql="insert into "+self.entrPsCodBr.get()+"(codigo,situacao)values('"+listcod+"','ativo')"
try:
cursor.execute(sql)
db.commit()
print('Dados Gravados')
except MySQLdb as erro:
print('Nao conseguiu Gravar')
db.close()
This is the error that gives:
File "C:\Python27\lib\lib-tk\Tkinter.py", line 2619, in get
return self.tk.call(self._w, 'get', first)
TclError: bad listbox index "all": must be active, anchor, end, @x,y, or a number