Você está na página 1de 1

# coding = utf-8

import PySimpleGUI as sg

layout = [
[sg.Text('Por favor, digite seu nome, matricula e e-mail.')],
[sg.Text('Nome', size=(15, 1)), sg.InputText(key='nome')],
[sg.Text('CPF', size=(15, 1)), sg.InputText(key='cpf')],
[sg.Text('Email', size=(15, 1)), sg.InputText(key='email')],
[sg.Text('Fone', size=(15, 1)), sg.InputText(key='fone')],
[sg.Submit(), sg.Cancel()]
]

window = sg.Window('Titulo da janela').Layout(layout)


button, values = window.Read()

while True:
event, values = window.Read()
if event == 'Submit':
if values['nome'] is '' or values['cpf'] is '':
sg.Popup('nome e cpf e obrigatorio')
else:
break

if event == 'Cancel':
break

arq = open('arquivos.txt','a')
arq.write(values['nome'] + ';'+ values['cpf']+';'+values['email']+values['fone']+
'\n')
arq.close()

Você também pode gostar