User Registration GUI with CustomTkinter

This snippet demonstrates how to create a simple user registration interface using the CustomTkinter library in Python. It includes fields for name and age, and prints the input when the user clicks the 'Cadastrar' button. The GUI features a dark appearance mode for better visibility.
 avatar
unknown
python
5 months ago
895 B
5
Indexable
import customtkinter as ctk

def cadastrar():
    nome=(texto_nome.get())
    idade=(texto_idade.get())
    
    print(f' Voce cadastrou  {nome} com a idade {idade} .')


ctk.set_appearance_mode('dark')
janela=ctk.CTk()

janela.geometry('300x300')
janela.title('Tela de Cadastro')

texto_cadastrousuario=ctk.CTkLabel(janela, text='Cadastro de Usuário')
texto_cadastrousuario.pack(pady=5)

texto_nome=ctk.CTkLabel(janela, text='Digite seu Nome')
texto_nome.pack(pady=5)
texto_nome=ctk.CTkEntry(janela,placeholder_text='Digite seu Nome')
texto_nome.pack(pady=5)

texto_idade=ctk.CTkLabel(janela, text='Digite sua Idade')
texto_idade.pack(pady=5)
texto_idade=ctk.CTkEntry(janela,placeholder_text='Digite sua Idade')
texto_idade.pack(pady=5)

botao_cadastrar=ctk.CTkButton(janela, text='Cadastrar',command=cadastrar)
botao_cadastrar.pack(pady=20)


janela.mainloop()
Editor is loading...
Leave a Comment