I have created a file with different tables inside along with fields in each of the tables. When I use "db = sqlite3.connect('File')" it connects to the file but when I go to paste it in the text.grid, it doesn't appear to be organised. Is there a way to put it into a table so it looks more organised?
Here is some of the code I use, Thanks!!
def CustomerDetails():
db = sqlite3.connect('File')
cursor = db.cursor()
sql1 = "select * FROM CustomerTable"
cursor.execute(sql1)
result = cursor.fetchall()
count = (len(result))
for each in result:
out = each
message = out
text.insert(0.0, message)
text.insert(0.0, '\n' )
cursor.close()
and
# Frame 1 Heading buttons
labelspare=Label(f1, text =" ").grid(column=1, row=1, sticky=(W, E))
f1button1=Button(f1, text="Current Orders").grid(column=2, row=2, sticky=(W,E), ipadx = 20, ipady = 10, padx = 5, pady = 5)
f1button2=Button(f1, text="Order",command = CurrentOrders).grid(column=3, row=2, sticky=(W, E), ipadx = 20, ipady = 10, padx = 5, pady = 5)
f1button3=Button(f1, text="Customer",command = CustomerDetails).grid(column=4, row=2, sticky=(W, E), ipadx = 20, ipady = 10, padx = 5, pady = 5)
f1button4=Button(f1, text="Products",command = ProductDetails).grid(column=5, row=2, sticky=(W, E), ipadx = 20, ipady = 10, padx = 5, pady = 5)
labelspare=Label(f1, text =" ").grid(column=1, row=3, sticky=(W, E))
labelspare=Label(f1, text =" ").grid(column=1, row=4, sticky=(W, E))
text=Text(f1, width = 125, height = 42, wrap = WORD)
text.grid(row = 4,column=2,columnspan = 8, sticky =(W, E))
Basically, once the button is clicked the subroutine should run and paste the file into the text.grid but it just looks very unorganized, as though it literally just pasted the file in.
To resolve any confusion, I have added a picture of some fictitious data to show how "Unorganized" the data is. The fields don't align how I would like them too, similar to an excel spreadsheet. http://imgur.com/8MTPpAx