Recuperando o MySQL com o Kivy
Eu tenho um código Kivy, onde a saída é:
Eu quero substituir oBox No.
com seqüências de caracteres recuperadas do MySQL
Até agora, tentei implementar o MySQL no script python:
class RemoveScreen(MyLayout):
def __init__(self,**kwargs):
db = MySQLdb.connect("localhost", "root", "[PASSWORD]", "tcs_microrage_crm")
cursor=db.cursor()
self.var = StringVar()
self.label1 = Label(self, text=0, textvariable=self.var)
myvar=str(self.var)
#http://stackoverflow.com/questions/775296/python-mysql-parameterized-queries
cursor.execute("SELECT part_name FROM stock_lists WHERE part_number = %s", (myvar))
self.myvar=StringVar()
self.myvar.set(cursor.fetchone())
self.label2 = Label(self, text=0, textvariable=myvar)
Mas isso não funcionou.
Q: Como posso fazer consultas MySQL e imprimir strings individuais no arquivo kv.