Exemplo: Quero um numero em uma linha, depois em outra linha.
Mas tudo dentro do mesmo arquivo de texto gerado.
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