Last active
August 4, 2021 14:47
-
-
Save rodrigo-x/00609992bbe6a4c112fd89f0b7e25301 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import tkinter as tk | |
import webbrowser as driver | |
# Criar a janela "root" | |
root = tk.Tk() | |
# SnakeCase | |
def abrir_site(): | |
url = "https://www.facebook.com/groups/pythonbr" # Grupo do facebook | |
driver.open_new(url) | |
# Pegar a imagem com o caminho. | |
imagem = tk.PhotoImage(file=r"\home\rodrigo\facebook.png") | |
# Informa ao Tkinter que estamos trabalhando com um botão | |
botao = tk.Button(root, image=imagem, command=abrir_site) | |
botao.imagem = imagem | |
# Colocamos no lugar correto dentro da dialog x = Horizontal e Y = Vertical | |
botao.place(x="35", y="10") | |
# Título da janela | |
root.title("Botão") | |
# Tamanho da janela largura x altura | |
root.geometry("300x250") | |
# Cor de fundo da janela | |
root.configure(background="#FFFFFF") | |
# Tiramos o maximizar | |
root.resizable(False, False) | |
# Acrescentamos o ícone a partir de um arquivo.ico | |
root.iconbitmap(r"home\rodrigo\checklist.ico") | |
# Colocamos a dialog no meio | |
root.eval("tk::PlaceWindow . center") | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment