0
Example: I want a number in one line, then in another line.
But all within the same generated text file.
from tkinter import*
janela = Tk()
#################Cria o arquivo##########################
def nomearq():
arquivo = open(nameet.get(), 'w')
###########insere os dados no arquivo#############################
def esc():
arquivo = open(nameet.get(), 'r')
conteudo = arquivo.readlines()
conteudo.append(etmat.get())
arquivo = open(nameet.get(), 'w')
arquivo.writelines(conteudo)
arquivo.close()
#############################################
mat = Label(janela, text="matricula:")
mat.grid(row=1, column=1)
etmat = Entry(janela,)
etmat.grid(row=1, column=2)
##############################################
namearq = Label(janela, text="nome do arquivo:")
namearq.grid(row=2, column=1)
nameet = Entry(janela,)
nameet.grid(row=2, column=2)
##############################################
Com = Button(text="Comfirmar", command=esc
)
Com.grid(row=3,column=2)
##############################################
ger = Button(text="Gerar txt", command=nomearq)
ger.grid(row=4,column=2)
janela.geometry('300x300')
janela.mainloop
Thanks friend helped me a lot
– Lucas Oliveira Faria