Thank's for your time.
Can't show table's column data from mysql.
I need to show the two columns results, product_code and product_name columns.
I can connect to mysql database, access to headers in tables and print them but not to column results.
My admin.py
class AdminWindow(BoxLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.mydb = mysql.connector.connect(
host='localhost',
user='root',
passwd='',
database='pos2users'
)
self.mycursor = self.mydb.cursor()
self.mycursor.execute('SELECT * FROM stock')
products = self.get_products()
prod_table = DataTable(table=products)
product_code = []
product_name = []
spinner_values = []
for product in products:
product_code.append(product[0])
name = product[1]
if len(name) > 10:
name = name[:10] + '...'
product_name.append(name)
for x in range(len(product_code)):
line = ' | '.join([product_code[x], product_name[x]])
spinner_values.append(line)
self.ids.target_product.values = spinner_values

