I am using the tkinter
grid for user input that have 5 cols and 10 rows.
How to save this all data in pandas dataframe
and export to excel
?
import pandas as pd
from tkinter import *
root=Tk()
entries = []
for i in range(10):
en = Entry(root)
en.grid(row=i+1, column=0)
en1 = Entry(root)
en1.grid(row=i+1, column=1)
entries.append([en,en1])
def hallo():
for entry in entries:
rowLen = len(entries)
colLen = len(entries[0])
for c in range(colLen):
for r in range(rowLen):
print( entries[r][c])
def hallo1():
print(data)
def hallo12():
df = pd.DataFrame(data)
print(df)
button=Button(root,text="krijg",command=hallo).grid(row=12,column=0)
button1=Button(root,text="kxcvxrijg",command=hallo1).grid(row=13,column=0)
button3=Button(root,text="kxcvxrijg",command=hallo12).grid(row=14,column=0)
data = []
root.mainloop()
this above my code without error but the result is below we need the cell value for save to df and export to excel [Running] python -u "d:\MFA\pythonfile\ttta.py" .!entry .!entry3 .!entry5 .!entry7
Please guide me and send the right code.
replace lines 7->20 ( with the code above ) and I assumed you have the Excel export code so this is all you should need. hope it helps