Answer the question
In order to leave comments, you need to log in
How to stretch column widths in Excel using Pandas?
There is this code:
import pandas as pd
from tkinter import *
from time import gmtime, strftime
def write():
lasname = str(lastnameentry.get())
lastlastname = str(lastlastnameentry.get())
birthday = str(birthdayentry.get())
name = str(nameentry.get())
df = pd.read_excel('list.xlsx', engine='openpyxl')
df = df.replace('%lastname%', lasname)
df = df.replace('%lastlastname%', lastlastname)
df = df.replace('%birth%', birthday)
df = df.replace('%name%', name)
date = strftime("%d-%m-%Y", gmtime())
filename = name+' '+lasname+' '+date+'.xlsx'
df.to_excel(filename, index=False)
#Tkinter
root = Tk()
root.geometry('500x500')
root.title('Write Excel')
root.resizable(width=False, height=False)
namelabel = Label(root, text='Имя:', font='Arial 25')
nameentry = Entry(root, font='Arial 25')
lastnamelabel = Label(root, text='Фамилия:', font='Arial 25')
lastnameentry = Entry(root, font='Arial 25')
lastlastnamelabel = Label(root, text='Отчество:', font='Arial 25')
lastlastnameentry = Entry(root, font='Arial 25')
birthdaylabel = Label(root, text='Дата рождения:', font='Arial 25')
birthdayentry = Entry(root, font='Arial 25')
writebutton = Button(root, text='Записать', command=write, font='Arial 25')
namelabel.pack()
nameentry.pack()
lastnamelabel.pack()
lastnameentry.pack()
lastlastnamelabel.pack()
lastlastnameentry.pack()
birthdaylabel.pack()
birthdayentry.pack()
writebutton.pack()
root.mainloop()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question