Mensagens

A mostrar mensagens de setembro, 2024

Valor de Mercado da Empresa

from tkinter import * root = Tk() root.geometry( "500x400" ) root.resizable( 0 , 0 ) root.config( bg = "#103030" ) root.title( "Valor de Mercado da Empresa " ) titulo = Label( text = "Valor de Mercado da Empresa" , font =( "Arial" , "25" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) titulo.place( relx = 0.05 , rely = 0.05 ) texto_sub1 = Label( text = "Número de Acções:" , font =( "Arial" , "18" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) texto_sub1.place( relx = 0.05 , rely = 0.25 ) texto_sub2 = Label( text = "Preço da Acção:" , font =( "Arial" , "18" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) texto_sub2.place( relx = 0.08 , rely = 0.45 ) Número_Acções = StringVar() Número_Acções_entrada = Entry( textvariable =Número_Ac...

Jogo do Balde

import random import time def embaralhar_balde (): balde = [ "Cheio" , "Vazio" , "Vazio" , "Cheio" , "Cheio" , "Vazio" ] random.shuffle(balde) return balde def jogar (): jogadores = [ "Jogador 1" , "Jogador 2" , "Jogador 3" , "Jogador 4" , "Jogador 5" ] balde = embaralhar_balde() caixas = list ( range ( 1 , 7 )) for jogador in jogadores: escolha_valida = False while not escolha_valida: try : time.sleep( 2 ) print ( f"Caixas disponíveis: { caixas } " ) print ( f"Balde: { balde } " ) escolha = int ( input ( f" { jogador } , escolha uma caixa de 1 a 6: " )) if escolha not in caixas: raise ValueError ( "Escolha inválida ou já utilizada. Tente novamente." ) indice_escolha = ...

Comparar a velocidade da Luz

from tkinter import * root = Tk() root.geometry( "400x400" ) root.resizable( 0 , 0 ) root.config( bg = "#103030" ) root.title( "Comparar a velocidade da Luz" ) # Título titulo = Label( text = "Comparar a velocidade do Luz" , font =( "Arial" , 18 , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) titulo.place( relx = 0.05 , rely = 0.05 ) # Texto de subtítulo texto_sub1 = Label( text = "Velocidade (em m/s):" , font =( "Arial" , 15 , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) texto_sub1.place( relx = 0.05 , rely = 0.3 ) # Entrada de velocidade Velocidade = StringVar() Velocidade_entrada = Entry( textvariable =Velocidade , font =( "Arial" , 12 , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Velocidade_entrada.place(...

Valores Pulsação

from tkinter import * root = Tk() root.geometry( "400x400" ) root.resizable( 0 , 0 ) root.config( bg = "#103030" ) root.title( "Valores Pulsação " ) titulo = Label( text = "Valores Pulsação" , font =( "Arial" , "28" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) titulo.place( relx = 0.1 , rely = 0.05 ) sub1 = Label( text = "Valores Pulsação: " , font =( "Arial" , "18" , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) sub1.place( relx = 0.05 , rely = 0.25 ) Pulsação = StringVar() Pulsação_entrada = Entry( textvariable =Pulsação , font =( "Arial" , "12" , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Pulsação_entrada.place( relx = 0.62 , rely = 0.26 , relwidth = 0.35 ) Pulsação_entrada.focus() def limpar (): Pulsação_entrada.del...

Base na Relação Cintura-Quadril

from tkinter import * from functools import partial tempVal = "Homens" def store_temp (sel_temp): global tempVal tempVal = sel_temp def call_convert (rlabel1 , inputn): try : tem = float (inputn.get()) # Convert input to float if tempVal == 'Homens' : if tem < 0.9 : mensagem = "Baixo Risco" elif tem < 1 : mensagem = "Risco Moderado" else : mensagem = "Alto risco" elif tempVal == 'Mulheres' : if tem < 0.8 : mensagem = "Baixo Risco" elif tem < 0.85 : mensagem = "Risco Moderado" else : mensagem = "Alto risco" rlabel1.config( text = f" { mensagem } " ) except ValueError : rlabel1.config( text = "Por favor, insira um número válido." ) root = Tk() root.ge...

Comparar a velocidade do som

from tkinter import * root = Tk() root.geometry( "400x400" ) root.resizable( 0 , 0 ) root.config( bg = "#103030" ) root.title( "Comparar a velocidade do som" ) # Título titulo = Label( text = "Comparar a velocidade do som" , font =( "Arial" , 18 , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) titulo.place( relx = 0.05 , rely = 0.05 ) # Texto de subtítulo texto_sub1 = Label( text = "Velocidade (em m/s):" , font =( "Arial" , 15 , "bold" ) , bg = "#103030" , fg = "#49e3e3" ) texto_sub1.place( relx = 0.05 , rely = 0.3 ) # Entrada de velocidade Velocidade = StringVar() Velocidade_entrada = Entry( textvariable =Velocidade , font =( "Arial" , 12 , "bold" ) , bg = "white" , fg = "blue" , justify = 'center' ) Velocidade_entrada.place(...

Cores de Pulseira

import tkinter as tk tempVal = "Vermelho" def store_temp (sel_temp): global tempVal tempVal = sel_temp def call_convert (rlabel1): global tempVal if tempVal == 'Vermelho' : mensagem = "Emergência (prioridade 1) \n Tempo de Espera: 0 min" result_label1.config( fg = "red" ) elif tempVal == 'Laranja' : mensagem = "Muito urgente (prioridade 2) \n Tempo de Espera: 10 min" result_label1.config( fg = "orange" ) elif tempVal == 'Amarelo' : mensagem = "Urgente (prioridade 3) \n Tempo de Espera: 60 min" result_label1.config( fg = "yellow" ) elif tempVal == 'Verde' : mensagem = "Pouco urgente (prioridade 4) \n Tempo de Espera: 120 min" result_label1.config( fg = "green" ) elif tempVal == 'Azul' : mensagem = "Não urgente (prioridade 5) \n Tempo de Espera: 24...

Tabela periódica por Símbolo Químico

import unicodedata from tkinter import * # Dicionário da tabela periódica tabela_periodica = { 1 : { "nome" : "Hidrogênio" , "simbolo" : "H" , "massa_atomica" : 1.008 } , 2 : { "nome" : "Hélio" , "simbolo" : "He" , "massa_atomica" : 4.0026 } , 3 : { "nome" : "Lítio" , "simbolo" : "Li" , "massa_atomica" : 6.94 } , 4 : { "nome" : "Berílio" , "simbolo" : "Be" , "massa_atomica" : 9.0122 } , 5 : { "nome" : "Boro" , "simbolo" : "B" , "massa_atomica" : 10.81 } , 6 : { "nome" : "Carbono" , "simbolo" : "C" , "massa_atomica" : 12.011 } , 7 : { "nome" : "Nitrogênio" , "simbolo" : "N" , "massa_atomica" : 14.007 } , 8 : { ...