My python program only saves the first row but doesn't save the other columns. On my Track.xlsx file when I press the save button, the program only saves the first line the rest does not save it and it is as if it did not take into consideration the text inside the various textboxes and comboboxes.
I am a beginner, can anyone help me?
from cProfile import label
from copyreg import clear_extension_cache
from distutils.command.clean import clean
from importlib.resources import path
from sqlite3 import Row
from tkinter import filedialog
import pandas
from openpyxl import *
from tkinter.messagebox import showinfo
from ast import main
from cgitb import text
#import curses
#from curses.textpad import tb
#import email
from faulthandler import disable
from multiprocessing.sharedctypes import Value
from operator import index
from tkinter import *
import tkinter as tk
from tkinter.messagebox import showinfo
from tkinter.ttk import Combobox
from turtle import pd, width
from unicodedata import name
from webbrowser import get
import openpyxl
import xlrd
from openpyxl import workbook
import pathlib
# Comandi
def load():
path=filedialog.askopenfilename()
df=pandas.read_excel(path)
print(df)
def save():
mese = entry2.get()
altezza = entry3.get()
peso = entry4.get()
mmagra = entry5.get()
mgrassa = entry6.get()
utente = entry7.get()
wb = Workbook()
ws = wb.active
ws['A1'] = "Mese"
ws['B1'] = "Altezza"
ws['C1'] = "Peso"
ws['D1'] = "Massa Magra"
ws['E1'] = "Massa Grassa"
ws['F1'] = "Utente"
ws['A2'] = mese
ws['B2'] = altezza
ws['C2'] = peso
ws['D2'] = mmagra
ws['E2'] = mgrassa
ws['F2'] = utente
wb.save(r'C:\Users\lricci\Desktop\SERVER\web\Gym Tracker\Gym Tracker v1.0\track.xlsx')
showinfo("Salvataggio")
file1 = pandas.read_excel("track.xlsx")
file2 = pandas.read_excel("trackn.xlsx")
all = [file1, file2]
append = pandas.concat(all)
append.to_excel("track.xlsx", index=False)
def delete():
entry2.delete(0, tk.END)
entry3.delete(0, tk.END)
entry4.delete(0, tk.END)
entry5.delete(0, tk.END)
entry6.delete(0, tk.END)
entry7.delete(0, tk.END)
# Main frame
windows = tk.Tk()
windows.geometry("400x350")
windows.title("Gym Tracker")
windows.resizable(False, False)
#Frame 2
frame1 = Frame(windows, width=150, height=30, highlightcolor="white",highlightbackground="black", highlightthickness=1).place(x=120, y=2)
label1= Label(windows, text="GYM TRACKER").place(x=150, y=7)
frame2 = Frame(windows, width=500, height=1, highlightcolor="white",highlightbackground="black", highlightthickness=1).place(x=2, y=45)
# Combobox Mese
label2 = Label(windows, text="Mese").place(x=110, y=60)
cb1 = Combobox(windows, values=['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno','Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre']).place(x=200, y=60)
entry2 = tk.Entry(windows)
label3 = Label(windows, text="Altezza").place(x=110, y=90)
tb3 = Text(windows, width=17, height=1).place(x=200, y=90)
entry3 = tk.Entry(windows)
label4 = Label(windows, text="Peso").place(x=110, y=120)
tb4 = Text(windows, width=17, height=1).place(x=200, y=120)
entry4 = tk.Entry(windows)
label5 = Label(windows, text="Massa Magra").place(x=110, y=150)
tb5 = Text(windows, width=17, height=1).place(x=200, y=150)
entry5 = tk.Entry(windows)
label6 = Label(windows, text="Massa Grassa").place(x=110, y=180)
tb6 = Text(windows, width=17, height=1).place(x=200, y=180)
entry6 = tk.Entry(windows)
# Combobox Utente
label7 = Label(windows, text="Utente").place(x=110, y=210)
combobox = Combobox(windows, values=['Erika', 'Lorenzo']).place(x=200, y=210)
entry7 = tk.Entry(windows)
# Bottoni
btdelete = tk.Button(windows, text="Elimina", command=delete ,width=8, height=1).place(x=170, y=310)
btload = tk.Button(windows, text="Load", width=8, height=1,command=load).place(x=300, y=310)
btsave = tk.Button(windows, text="Salva", width=8, height=1, command=save).place(x=50, y=310)
windows.mainloop()