-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscreen.py
More file actions
38 lines (32 loc) · 1.23 KB
/
screen.py
File metadata and controls
38 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import PySimpleGUI as sg
class TelaPython:
def __init__(self):
# theme
sg.theme('DarkAmber')
# layout
layout = [
[sg.Text('Nome', size=(5,0)), sg.Input(size=(20,0), key='nome')],
[sg.Text('Idade', size=(5,0)), sg.Input(size=(20,0), key='idade')],
[sg.Text('Que redes sociais você usa?', size=(25,0))],
[sg.Checkbox('Tik Tok', key='tik tok'),
sg.Checkbox('YouTube', key='youtube'),
sg.Checkbox('WhatsApp', key='whatsapp')],
[sg.Button('Enviar dados')]
]
#janela
janela = sg.Window('Dados do Usuário').layout(layout)
#extrair os dados da tela
self.button, self.values = janela.Read()
def Iniciar(self):
nome = self.values['nome']
idade = self.values['idade']
usa_tik_tok = self.values['tik tok']
usa_youtube = self.values['youtube']
usa_whatsapp = self.values['whatsapp']
print(f'nome: {nome}')
print(f'idade: {idade}')
print(f'usa tik tok: {usa_tik_tok}')
print(f'usa youtube: {usa_youtube}')
print(f'usa whatsapp: {usa_whatsapp}')
tela = TelaPython()
tela.Iniciar()