Last active
May 20, 2021 13:22
-
-
Save WalterSilva5/404b5bbf7b43e1b4b4e37285e7892a90 to your computer and use it in GitHub Desktop.
TKINTER
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 * | |
from tkinter.ttk import * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
botaoMarcavelStatus = BooleanVar() | |
botaoMarcavelStatus.set(False) #Definimos um status padrã#o para o botão | |
botaoMarcavel = Checkbutton(window, text='Marque aqui', var=botaoMarcavelStatus) | |
botaoMarcavel.pack() | |
window.mainloop() |
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 * | |
from tkinter.ttk import * | |
def recuperarEstado(): | |
if botaoMarcavelStatus.get() ==True: | |
valor = "sim" | |
else: | |
valor = "não" | |
mensagem["text"]="Valor: "+str(valor) | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
mensagem = Label(window, text="Marcado: ", font="arial 15 bold") | |
mensagem.pack() | |
botaoMarcavelStatus = BooleanVar() | |
botaoMarcavelStatus.set(False) #Definimos um status padrão para o botão | |
botaoMarcavel = Checkbutton(window, text='Marque aqui', var=botaoMarcavelStatus) | |
botaoMarcavel.pack() | |
botao = Button(window, text="Clique Aqui!", command=recuperarEstado) | |
botao.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
entrada = Entry(window, font="arial 15 bold") | |
entrada.pack() | |
entrada.focus() | |
window.mainloop() |
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 * # importamos o pacote tkinter | |
window = Tk() # instanciamos a classe tk | |
# a variavel window agora é uma instancia da classe tk | |
# o nome da variavel não fara diferença! | |
# definimos o titulo da janela | |
window.title("TI fora da caixa") | |
# colocamos a janela em loop para ela permanecer aberto. | |
window.mainloop() |
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 * | |
from tkinter.ttk import * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
combo = Combobox(window) | |
combo['values']= (1, 2, 3, 4, 5, "Text") | |
combo.current(0) #definimos o valor padrão par ser exibido! | |
combo.pack() | |
window.mainloop() |
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 * | |
from tkinter.ttk import * | |
def exibeValor(): | |
mensagem["text"]="Valor: "+combo.get() | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
combo = Combobox(window) | |
combo['values']= (1, 2, 3, 4, 5, "Text") | |
combo.current(0) #definimos o valor padrão! | |
combo.pack() | |
botao = Button(window, text="Clique Aqui!", command=exibeValor) | |
botao.pack() | |
mensagem = Label(window, text="Valor: ", font="arial 15 bold") | |
mensagem.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.title("TI fora da caixa") | |
texto = Label(window, text="Ola Mundo!") | |
texto.pack()#adicionamos o widget a janela | |
#Label é o nome do widget e texto é a variavel que guarda a label | |
#a label esta recebendo dois parametros | |
#o primeiro(window) é o nome da janela na qual a label sera inserida | |
#o segundo (text="Ola mundo!") é a string que queremos exibir na label | |
#na linha texto.pack()estamos posicionando o widget na janela | |
#veja mais sobre isso na sessão de posicionamentos! | |
window.mainloop() |
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 * | |
window = Tk() | |
window.title("TI fora da caixa") | |
texto = Label(window, text="Ola Mundo!") | |
#alteramos o texto | |
texto["text"] = "este texto sera exibido" | |
#adicionamos o widget a janela | |
texto.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.title("TI fora da caixa") | |
#ao criarmos a label passamos o parâmetro font | |
texto = Label(window, text="TI fora da caixa", font="impact 20 bold") | |
texto.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
texto = Label(window, text="TI fora da caixa", font="impact 20 bold") | |
texto.pack() | |
botao = Button(window, text="Clique Aqui") | |
botao.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
texto = Label(window, text="TI fora da caixa", font="impact 20 bold") | |
texto.pack() | |
botao = Button(window, text="Clique Aqui", bg="black", fg="white") | |
botao.pack() | |
window.mainloop() |
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 aoClicar(): | |
mensagem["text"]="O Botão Foi Clicado" | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
mensagem = Label(window, text="TI fora da caixa", font="impact 20 bold") | |
mensagem.pack() | |
botao = Button(window, text="Clique Aqui", command=aoClicar) | |
botao.pack() | |
window.mainloop() |
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 aoClicar(): | |
mensagem["text"]="texto: "+entrada.get() | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
entrada = Entry(window, font="arial 15 bold") | |
entrada.pack() | |
mensagem = Label(window, text="TI fora da caixa", font="impact 20 bold") | |
mensagem.pack() | |
botao = Button(window, text="Clique Aqui", command=aoClicar) | |
botao.pack() | |
window.mainloop() |
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 * | |
window = Tk() | |
window.geometry("300x200+200+100") | |
window.title("TI fora da caixa") | |
entrada = Entry(window, font="arial 15 bold") | |
entrada.pack() | |
entrada["state"]="disabled" | |
window.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment