Mensagens

A mostrar mensagens de abril, 2023

Converter Milha Terrestre para Milha Naútica e Converter Milha Naútica para Milha Terrestre

from tkinter import * from tkinter import ttk root=Tk() class appmilha(): def __init__ ( self ): self .root = root self .janela() self .frames_da_janela() self .widgets_frame1() self .Menus() root.mainloop() def janela ( self ): self .root.title( "Milha" ) self .root.configure( background = '#1e3743' ) self .root.geometry( "600x200" ) self .root.resizable( 0 , 0 ) 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.96 ) def widgets_frame1 ( self ): self .abas = ttk.Notebook( self .frame_1) self .milhaterreste = Frame( self .aba...

Rentibilidade do Investimento

from tkinter import * root = Tk() root.geometry( "350x350" ) root.resizable( 0 , 0 ) root.config( bg = "#d9ead3" ) root.title( "ROI" ) def app (): r = Rentibilidade.get() i = Investimento.get() a = (r-i) roi =(a/i)* 100 resultado.set(roi) def limpar (): Investimento_entrada.delete( 0 , END) Rentibilidade_entrada.delete( 0 , END) titulo = Label( text = "Rentibilidade do Investimento" , font =( "Arial" , "15" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) titulo.place( relx = 0.1 , rely = 0.05 ) texto_sub1 = Label( text = "Rentibilidade" , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) texto_sub1.place( relx = 0.13 , rely = 0.25 ) texto_sub2 = Label( text = "Investimento" , font =( "Arial" , "12" , "...

Taxa de Condomínio

from tkinter import * root = Tk() root.geometry( "600x300" ) root.resizable( 0 , 0 ) root.config( bg = "#d9ead3" ) root.title( "Taxa de Condomínio " ) def app (): n = Número_Total_Unidades.get() despesas = Despesas_Condomínio.get() tx_condomino = (despesas/n) tx_condominoarr = round (tx_condomino , 2 ) resultado.set(tx_condominoarr) def limpar (): Despesas_Condomínio_entrada.delete( 0 , END) Número_Total_Unidades_entrada.delete( 0 , END) titulo = Label( text = "Taxa de Condomínio " , font =( "Arial" , "15" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) titulo.place( relx = 0.35 , rely = 0.05 ) texto_sub1 = Label( text = "Total de Despesas do Condomínio :" , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) texto_sub1.place( relx = 0.05 , rely = 0.25 ) text...

Máquina caça-níqueis

import random import time escolha= True while escolha: print ( " \n " ) print ( " \033 [1;36m= \033 [m" * 60 ) print ( " \t\t\t\t\t Máquina caça-níqueis" ) print ( " \033 [1;36m= \033 [m" * 60 ) print ( """ 1. \t Jogo \n 2. \t Exit/Quit/Saída """ ) escolha= input ( "Escolha uma opção: " ) if escolha== "1" : time.sleep( 2 ) simbolos = [ "$" , "%" , "&" , "7" , "X" , "@" ] simbolo1 = random.choice(simbolos) simbolo2 = random.choice(simbolos) simbolo3 = random.choice(simbolos) print ( " \n " ) print ( f" \033 [1;32m { simbolo1 }\033 [m | \033 [1;33m { simbolo2 }\033 [m | \033 [1;35m { simbolo3 }\033 [m" ) print ( " \n " ) time.sleep( 3 ) if simbolo1 == simbolo2 == simbolo3: ...

Volume de um tronco de cone

from tkinter import * import math root = Tk() root.geometry( "400x400" ) root.resizable( 0 , 0 ) root.config( bg = "#d9ead3" ) root.title( "Volume de um tronco de cone" ) #V=πh/3 ⋅ (R2+Rr+r2) #h → altura do tronco de cone; #r → raio da base menor do cone; #R → raio da base maior do cone. titulo = Label( text = "Volume de um tronco de cone" , font =( "Arial" , "15" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) titulo.place( relx = 0.15 , rely = 0.05 ) texto_sub1 = Label( text = "Altura do tronco do cone:" , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) texto_sub1.place( relx = 0.05 , rely = 0.25 ) texto_sub2 = Label( text = "Raio da base menor do cone:" , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg ...

(a+b)(a-b)

from tkinter import * root = Tk() root.geometry( "350x300" ) root.resizable( 0 , 0 ) root.config( bg = "#d9ead3" ) root.title( "(a+b)(a-b)" ) def app (): va = a.get() vb = b.get() r = pow (va , 2 )- pow (vb , 2 ) resultado.set(r) def limpar (): a_entrada.delete( 0 , END) b_entrada.delete( 0 , END) titulo = Label( text = "(a+b)(a-b)" , font =( "Arial" , "15" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) titulo.place( relx = 0.4 , rely = 0.05 ) texto_sub1 = Label( text = "A: " , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) texto_sub1.place( relx = 0.2 , rely = 0.25 ) texto_sub2 = Label( text = "B: " , font =( "Arial" , "12" , "bold" ) , bg = "#d9ead3" , fg = "#bf9000" ) texto_sub2...

Converter unidadades de frequência

import tkinter as tk from functools import partial tempVal = "Hertz" def store_temp (sel_temp): global tempVal tempVal = sel_temp def call_convert (rlabel1 , rlabe12 , inputn): tem = inputn.get() if tempVal == 'Hertz' : kilohertz = float (( float (tem) / 1000 )) megahertz = float (( float (tem)/ 1000000 )) rlabel1.config( text = "%f kilohertz" % kilohertz) rlabe12.config( text = "%f Megahertz" % megahertz) if tempVal == 'Kilohertz' : Hertz1 = float (( float (tem)* 1000 )) megahertz1 = float (( float (tem)/ 1000 )) rlabel1.config( text = "%f Hertz" % Hertz1) rlabe12.config( text = "%f Megahertz" % megahertz1) if tempVal == 'Megahertz' : Hertz2 = float (( float (tem)* 1000000 )) kilohertz2 = float (( float (tem)* 1000 )) rlabel1.config( text = "%f Hertz" % Hertz2) rlabe12.config( te...

Calorias

calorias_por_minutos = { 'caminhada' : 5 , 'corrida' : 10 , 'natação' : 8 , 'ciclismo' : 7 } soma = 0 while True : Actividade = input ( "Digite o nome da atividade física (ou 'sair' para encerrar): " ) if Actividade == 'sair' : print ( f"A Soma total de calorias é de : { soma } " ) break def calcular_calurias (hobby , tempo): if hobby in calorias_por_minutos: calorias = calorias_por_minutos[hobby] * tempo return calorias else : return None Tempo_actividade = int ( input ( "Digite a duração em minutos: " )) calorias = calcular_calurias(Actividade , Tempo_actividade) soma = calorias + soma if calorias is not None : print ( f"A Soma total de calorias é de : { soma } " ) print ( f" { Tempo_actividade } minutos de { Actividade } queimam { calorias } calorias." ) else : ...

Dia 25 de Abril

Imagem
  from tkinter import * from PIL import Image , ImageTk root = Tk() root.geometry( "750x600" ) root.resizable( 0 , 0 ) root.config( bg = "#d9ead3" ) root.title( "25 de Abril" ) root.resizable( 0 , 0 ) img1=ImageTk.PhotoImage(Image.open( "imagem2.png" )) titulo = Label( text = "25 de Abril" , bg = "#d9ead3" , fg = "#ff0000" , font =( "Arial" , "50" , "bold" )) titulo.place( relx = 0.3 , rely = 0.05 ) subtitulo = Label( text = "Contra todos os Regimes Totalitários " , bg = "#d9ead3" , fg = "blue" , font =( "Arial" , "30" , "bold" )) subtitulo.place( relx = 0.05 , rely = 0.2 ) l_3 = Label( bg = "#d9ead3" ) l_3.place( relx = 0.1 , rely = 0.3 ) l_3.config( image =img1) root.mainloop() Imagem2