Mensagens

A mostrar mensagens de outubro, 2020

Email do SAPO, usando tkinter e selenium

Imagem
  from tkinter import * from selenium import webdriver from selenium.webdriver.common.keys import Keys root=Tk() class Application(): def __init__(self): self.root =root self.janela() self.entradas() root.mainloop() def janela(self): self.root.title("Login do Email Sapo") self.root.configure(background="lightgray"); self.root.geometry("400x200") self.root.resizable(TRUE, TRUE); self.root.minsize(width=200, height=200) self.root.maxsize(width=400, height=200) def entradas(self): # Email self.emailv = StringVar() self.lb_email1 = Label(text='Email:', bg='#383847', fg='white', font=('dyuthi', 10, 'bold')) self.lb_email1.place(relx=0.05, rely=0.15, relwidth=0.35) self.inp_email1 = Entry(fg='gray35', textvariable=self.emailv) self.inp_email1.plac...

Mudar de Letra de um glossário (usando selenium)

Para abrir site de forma automática pode tentar a seguinte maneira: from selenium import webdriver #pip install selenium from selenium.webdriver.common.keys import Keys from webdriver_manager.chrome import ChromeDriverManager #pip install webdriver_manager import time #Abre o Chrome driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get( 'https://web.whatsapp.com' ) #abre o site Whatsapp Web time.sleep( 15 ) from selenium import webdriver import time # Criar instância do navegador PATH="C:\Program Files (x86)\chromedriver.exe" driver = webdriver.Chrome(PATH) def glossario(letra): # Procurar na html o letra # Abrir a página do Todos Contam driver.get('https://www.todoscontam.pt/glossario/glossario/{}'.format(letra)) # Minimizar a página def fim (): print("Fim do Programa!") driver.maximize_window() time.sleep(3) driver.quit() while True: pergunta1=str(input("Deseja Procurar alguma letra ?" ...

Automatização o dicionário Priberam

from selenium import webdriver from selenium.webdriver.common.keys import Keys import time # Criar instância do navegador PATH="C:\Program Files (x86)\chromedriver.exe" driver = webdriver.Chrome(PATH) # Abrir a página do dicionário Priberam driver.get('https://dicionario.priberam.org/') #Minimizar a página driver.minimize_window() time.sleep(5) def dic(): #Procurar na html o nome search = driver.find_element_by_name("" "ctl00$wordMeaningContent" "PlaceHolder$wordMeaningContro" "l$SearchWordTextBox") #Escolher a palavra encontrar palavra=str(input("Palavra a procurar:")) search.send_keys("{}".format(palavra)) search.send_keys(Keys.RETURN) #Imprime a palavra pedida main = driver.find_element_by_class_name("pb-main-content") print(main.text) whi...

Área do círculo

#area do círculo π . r^2 import math raio = float ( input ( 'Digite o raio do circulo: ' )) areac = round ((math.pi * raio** 2 ) , 2 ) print ( 'A área do círculo é de ' , areac) # Usando Tkinter from tkinter import * import math root = Tk() root.geometry( "400x300" ) root.resizable( 0 , 0 ) root.config( bg = "#103030" ) root.title( "Área do círculo" ) titulo = Label( text = "Área do círculo" , font =( "Arial" , "30" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) titulo.place( relx = 0.13 , rely = 0.05 ) sub1 = Label( text = "Raio do círculo:" , font =( "Arial" , "16" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) sub1.place( relx = 0.08 , rely = 0.25 ) raio = StringVar() raio_entrada = Entry( textvariable =raio , font =( "Arial" , "12" , "bold" ) , ...

Área do retângulo

alturaret = float ( input ( 'Digite a altura do retângulo: ' )) baseret = float ( input ( 'Digite a altura do retângulo: ' )) arearet = round ((alturaret*baseret) , 2 ) print ( 'A área do retângulo é de ' , arearet)

Área do quadrado

lado = float ( input ( 'Digite a altura do quadrado: ' )) areaq = lado** 2 print ( 'A área do quadrado é de ' , areaq)

Calculadora de àreas

import math def areatriangungulo (): altura = float ( input ( 'Digite a altura do triângulo : ' )) base = float ( input ( 'Digite a base do triãngulo: ' )) areat = round (((base * altura) / 2 ) , 2 ) print ( 'A área do triângulo é de ' , areat) def areaquadradro (): lado = float ( input ( 'Digite a altura do quadrado: ' )) areaq = lado** 2 print ( 'A área do quadrado é de ' , areaq) def arearetangulo (): alturaret = float ( input ( 'Digite a altura do retângulo: ' )) baseret = float ( input ( 'Digite a altura do retângulo: ' )) arearet = round ((alturaret*baseret) , 2 ) print ( 'A área do retângulo é de ' , arearet) def areacirculo (): #area do círculo π . r2 raio = float ( input ( 'Digite o raio do circulo: ' )) areac = round ((math.pi * raio** 2 ) , 2 ) print ( 'A área do círculo é de ' , areac) escolha= True while escolha: print ( "...

Taxa de esforço financeiro em Python ( usando Flask )

Imagem
index.html <!DOCTYPE html > <html lang ="en" > <!doctype html > <head> <meta name ="viewport" content ="width=device-width, initial-scale=1" > <title> Calculador da Taxa de Esforço </title> <!-- Colocar CSS--> <link rel ="stylesheet" href ="https://unpkg.com/purecss@0.6.2/build/pure-min.css" integrity ="sha384-UQiGfs9ICog+LwheBSRCt1o5cbyKIHbwjWscjemyBMT9YCUMZffs6UqUTd0hObXD" crossorigin ="anonymous" > <link rel ="stylesheet" type ="text/css" href ="{{ url_for('static', filename='style.css') }}" > </head> <style> .texttxe{ color: blue; font-family: verdana; font-size: 100%; } </style> <h1> Taxa de Esforço </h1> <body> <div class ="main" > <div class ="main" > <form class ="pure-form" method ="POST" a...

Verificar um IP de um site

1- Ir à linha de comando 2 colocar o seguinte comando: nslookup www.google.com  (o google é colocado aqui como exemplo) Aparece o seguinte informação: Server: UnKnown Address: 2001:8a0:f5ee:5600::1 Non-authoritative answer: Name: www.google.com Addresses: 2a00:1450:4003:809::2004 216.58.209.68

5 melhores indicadores financeiros (usando tkinter)

from tkinter import * from tkinter import ttk import webbrowser root=Tk() class indicadores(): def __init__(self): self.root = root self.janela() self.frames_da_janela() self.widgets_frame1() self.widgets_frame2() self.Menus() root.mainloop() def janela(self): self.root.title("TOP 5 de Indicadores Fundamentalistas") self.root.configure(background='#1e3743') self.root.geometry("1100x500") self.root.resizable(True, True) self.root.maxsize(width=900, height=700) self.root.minsize(width=500, height=400) def frames_da_janela(self): self.frame_1 = Frame(self.root, bd=4, bg='#dfe3ee' , highlightbackground='#759fe6', highlightthickness=2) self.frame_1.place(relx=0.02, rely=0.02, relwidth=0.96, relheight=0.46) self.frame_2 = Frame(self.root, bd=4, bg='#dfe3ee' , highlightbackground='#759fe6', highlightthickness=2) self.frame_2.place(relx=0.02, rely=0.5, relwidth=0.96, relheight=0.46) def widgets_frame1(self): self.abas = ttk.Notebook(s...

Conversor de horas

def converter_de_horas_minutos (num_horas): minutos = num_horas * 60 return minutos def convert__de_horas_para_segundos (num_horas): minutes = converter_de_horas_minutos(num_horas) segundos = minutes * 60 return segundos def converter_de_minutos_horas (num_nim): mhoras = num_nim/ 60 return mhoras def convert__de_minutos_para_segundos (num_nim): ssegundos = num_nim * 60 return ssegundos def converter_de_segundos_horas (num_segundos): segundos_horas = num_segundos/ 3600 return segundos_horas def convert__de_segundos_para_minutos (num_segundos): h_minutes = converter_de_segundos_horas(num_segundos) m_segundos = h_minutes * 60 return m_segundos escolha= True while escolha: print ( """ 1.Converter horas 2.Converter Minutos 3.Converter Segundos 4.Exit/Quit/Saída """ ) escolha= input ( "Escolha uma opção: " ) if escolha== "1" : print ( ' \n ...

Resumir e converter artigos de notícias em arquivos de texto

#Instalar pip install newspaper3k import nltk from newspaper import Article nltk.download( 'punkt' ) url = 'https://observador.pt/2020/10/01/footb' \ 'all-leaks-colaboracao-de-rui-pinto-com-pj-tera-de-ir-ale' \ 'm-da-abertura-dos-discos/' article = Article(url , language = "pt" ) # Fazer NLP article.download() article.parse() article.nlp() #Nome do artigo print ( "Nome do Artigo" ) nome_artigo =article.title print (nome_artigo) print ( " \n " ) #Dar os autores print ( "Nome do Autor" ) nome_jornalista = article.authors print (nome_jornalista) print ( " \n " ) # Conseguir a data da publicação print ( "Data de Publicação" ) data = article.publish_date print (data) print ( " \n " ) # Conseguir a imagem print ( "Mostrar link de Foto" ) image = article.top_image print (image) print ( " \n " ) #Conseguir o artigo texto print ( "Artigo Completo" ) texto...