Created
October 31, 2014 02:32
-
-
Save maluta/f448c5a1431dc24e01bb to your computer and use it in GitHub Desktop.
Janela simples com dois botões.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
def principal(): | |
# definição da janela | |
janela = Tk() | |
# definindo o título da janela | |
janela.title("Exemplo #1") | |
# componentes | |
botão1 = Button(janela, text = "Botão #1") | |
botão2 = Button(janela, text = "Botão #2" ) | |
# organização na tela | |
botão1.pack() | |
botão2.pack() | |
# definindo "ações" para os botões | |
botão1.configure(command=click_botão1) | |
botão2.configure(command=click_botão2) | |
# ações | |
def click_botão1(): | |
print("evento: click no botão 1") | |
def click_botão2(): | |
print("evento: click no botão 2") | |
# rodando nosso programa | |
if __name__ == '__main__': | |
principal() | |
mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment