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(self.frame_1)
self.marl = Frame(self.abas)
self.roe = Frame(self.abas)
self.marl.configure(background="#dfe3ee")
self.roe.configure(background="#dfe3ee")
self.abas.add(self.marl, text="Margem Líquida")
self.abas.add(self.roe, text="Rendibilidade sobre o Património Líquido ")
self.abas.place(relx=0, rely=0, relwidth=0.98, relheight=0.98)
# Margem Líquida
self.lucrol = DoubleVar()
self.lb_lucrol = Label(self.marl, text="Lucro Líquido",bg='#dfe3ee', fg='#107db2')
self.lb_lucrol.place(relx=0.25, rely=0.05)
self.lucrol_entry = Entry(self.marl, textvariable=self.lucrol)
self.lucrol_entry.place(relx=0.4, rely=0.05, relwidth=0.1)
self.rlanual = DoubleVar()
self.lb_rlanual = Label(self.marl, text="Receita Líquida Anual",bg='#dfe3ee', fg='#107db2')
self.lb_rlanual.place(relx=0.25, rely=0.2)
self.rlanual_entry = Entry(self.marl, textvariable=self.rlanual)
self.rlanual_entry.place(relx=0.4, rely=0.2, relwidth=0.1)
self.bt_calcular1 = Button(self.marl, text="Calcular", bd=2,bg='#107db2', fg='white',
font=('verdana', 8, 'bold'),command=self.butaoclick1)
self.bt_calcular1.place(relx=0.6, rely=0.15, relwidth=0.2, relheight=0.25)
self.rml = StringVar()
self.resultado1 = Label(self.marl, textvariable=self.rml)
self.resultado1.place(relx=0.4, rely=0.35, relwidth=0.1)
self.lb_rml = Label(self.marl, text="Margem Líquida (em %)",bg='#dfe3ee', fg='#107db2')
self.lb_rml.place(relx=0.25, rely=0.35)
self.lb_text = Label(self.marl, text="Margem Líquida: mede a eficiência e viabilidade"
" da empresa, expressando o\n percentual de Lucro"
" Líquido em relação às Vendas Líquidas de um exercício.",
bg='#dfe3ee', fg='black')
self.lb_text.place(relx=0.2, rely=0.65)
#ROE
self.activoc1 = DoubleVar()
self.lb_activoc1 = Label(self.roe, text=" Total do Activo ",bg='#dfe3ee', fg='#107db2')
self.lb_activoc1.place(relx=0.05, rely=0.2)
self.activoc1_entry = Entry(self.roe, textvariable=self.activoc1)
self.activoc1_entry.place(relx=0.2, rely=0.2, relwidth=0.1)
self.passivoc1 = DoubleVar()
self.lb_passivoc1 = Label(self.roe, text="Total do Passivo",bg='#dfe3ee', fg='#107db2')
self.lb_passivoc1.place(relx=0.05, rely=0.4)
self.passivoc1_entry = Entry(self.roe,textvariable=self.passivoc1)
self.passivoc1_entry.place(relx=0.2, rely=0.4, relwidth=0.1)
self.receitast = DoubleVar()
self.lb_receitast = Label(self.roe,text=" Total das Receitas ",bg='#dfe3ee', fg='#107db2')
self.lb_receitast.place(relx=0.5, rely=0.2)
self.receitast_entry = Entry(self.roe,textvariable=self.receitast)
self.receitast_entry.place(relx=0.7, rely=0.2, relwidth=0.1)
self.custost = DoubleVar()
self.lb_custost = Label(self.roe,text="Total do Passivo",bg='#dfe3ee', fg='#107db2')
self.lb_custost .place(relx=0.5, rely=0.4)
self.custost_entry = Entry(self.roe,textvariable=self.custost )
self.custost_entry.place(relx=0.7, rely=0.4, relwidth=0.1)
# Butão de Calcular
self.bt_calcular2 = Button(self.roe,text="Calcular", bd=2,bg='#107db2',
fg='white', font=('verdana', 8, 'bold'),command=self.butaoclick2)
self.bt_calcular2.place(relx=0.15, rely=0.75, relwidth=0.15, relheight=0.2)
# Resultado do ROE
self.rroe = StringVar()
self.resultado2 = Label(self.roe, textvariable=self.rroe)
self.resultado2.place(relx=0.2, rely=0.6, relwidth=0.1)
self.lb_rroe = Label(self.roe, text="ROE (em %)",bg='#dfe3ee', fg='#107db2')
self.lb_rroe.place(relx=0.06, rely=0.6)
# Butão para os sites frame 1
self.bt_informacao = Button(self.roe, text="Informação sobre ROE ",
bd=2,bg='#107db2', fg='white', font=('verdana', 8, 'bold'),command=self.siteroe)
self.bt_informacao.place(relx=0.45, rely=0.6, relwidth=0.5, relheight=0.15)
def siteroe(self):
new = 2
url = "https://www.treasy.com.br/blog/custo-de-oportunidade-analise-de-roe-return-on-equity/"
webbrowser.open(url, new=new)
# Butão de resultados
def butaoclick1(self):
a = self.lucrol.get()
p = self.rlanual.get()
lg = a / p
lg1 = lg * 100
ra = round(lg1, 2)
return self.rml.set(ra)
def butaoclick2(self):
a = self.activoc1.get()
p = self.passivoc1.get()
rt = self.receitast.get()
ct = self.passivoc1.get()
lucro_liquido = rt -ct
patrimonio_liquido = a - p
rendibilidade = lucro_liquido / patrimonio_liquido
rendibilidade_percentagem = rendibilidade * 100
rendibilidade_arrundanda = round(rendibilidade_percentagem, 2)
return self.rroe.set(rendibilidade_arrundanda)
# Frame 2
def widgets_frame2(self):
self.abas = ttk.Notebook(self.frame_2)
self.dividend = Frame(self.abas)
self.dividaliqida = Frame(self.abas)
self.dividabruta = Frame(self.abas)
self.dividend.configure(background="#dfe3ee")
self.dividaliqida.configure(background="#dfe3ee")
self.dividabruta.configure(background="#dfe3ee")
self.abas.add(self.dividend, text="Dividend Yield")
self.abas.add(self.dividaliqida, text="Dívida Líquida ")
self.abas.add(self.dividabruta, text="Dívida Bruta ")
self.abas.place(relx=0, rely=0, relwidth=0.98, relheight=0.98)
# Dividend Yield
self.dividendopacao = DoubleVar()
self.lb_dividendopacao = Label(self.dividend, text="Dividendo anual por acçâo : ",
bg='#dfe3ee', fg='#107db2')
self.lb_dividendopacao .place(relx=0.1, rely=0.05)
self.dividendopacao_entry = Entry(self.dividend, textvariable=self.dividendopacao)
self.dividendopacao_entry.place(relx=0.3, rely=0.05, relwidth=0.1)
self.precoaccao = DoubleVar()
self.lb_precoaccao = Label(self.dividend, text="Preço por acção :",
bg='#dfe3ee', fg='#107db2')
self.lb_precoaccao.place(relx=0.1, rely=0.2)
self.precoaccao_entry = Entry(self.dividend, textvariable=self.precoaccao)
self.precoaccao_entry.place(relx=0.3, rely=0.2, relwidth=0.1)
self.bt_calcular3 = Button(self.dividend, text="Calcular", bd=2,
bg='#107db2', fg='white', font=('verdana', 8, 'bold'),command=self.butaoclick3)
self.bt_calcular3.place(relx=0.15, rely=0.6, relwidth=0.2, relheight=0.3)
self.dy = StringVar()
self.resultado3 = Label(self.dividend, textvariable=self.dy)
self.resultado3.place(relx=0.3, rely=0.35, relwidth=0.1)
self.lb_dy = Label(self.dividend, text="Dividend Yield (em %)",
bg='#dfe3ee', fg='#107db2')
self.lb_dy.place(relx=0.1, rely=0.35)
self.lb_text2 = Label(self.dividend, text="O Dividend Yield é um índice criado"""
" para medir a\n "
"rentabilidade dos dividendos "
"de uma empresa em"
" relação ao\n preço de suas ações."
" Este índice traz"
" o benefício de poder comparar a rentabilidade\n"
" dos dividendos entre empresas",bg='#dfe3ee', fg='black')
self.lb_text2.place(relx=0.45, rely=0.10)
self.bt_informacao_divid = Button(self.dividend, text="Informação sobre Dividend Yield ", bd=2,bg='#107db2',
fg='white', font=('verdana', 8, 'bold'),command=self.sitedividend_yield)
self.bt_informacao_divid.place(relx=0.45, rely=0.6, relwidth=0.5, relheight=0.15)
# Dívida Líquida
self.dividacp = DoubleVar()
self.lb_dividacp = Label(self.dividaliqida, text="Dívida de Curto Prazo:"
, bg='#dfe3ee', fg='#107db2')
self.lb_dividacp.place(relx=0.05, rely=0.05)
self.dividacp_entry = Entry(self.dividaliqida, textvariable=self.dividacp)
self.dividacp_entry.place(relx=0.25, rely=0.05, relwidth=0.1)
self.dividalp = DoubleVar()
self.lb_dividalp = Label(self.dividaliqida, text="Dívida de Longo Prazo "
, bg='#dfe3ee', fg='#107db2')
self.lb_dividalp.place(relx=0.45, rely=0.05)
self.dividalp_entry = Entry(self.dividaliqida, textvariable=self.dividalp)
self.dividalp_entry.place(relx=0.68, rely=0.05, relwidth=0.1)
self.disponibilidades = DoubleVar()
self.lb_disponibilidades = Label(self.dividaliqida, text="Disponibilidades (caixa): ",
bg='#dfe3ee', fg='#107db2')
self.lb_disponibilidades.place(relx=0.05, rely=0.2)
self.disponibilidades_entry = Entry(self.dividaliqida, textvariable=self.disponibilidades)
self.disponibilidades_entry.place(relx=0.25, rely=0.2, relwidth=0.1)
self.depordem = DoubleVar()
self.lb_depordem = Label(self.dividaliqida,text="Depósitos ordem/a prazo: ",
bg='#dfe3ee', fg='#107db2')
self.lb_depordem.place(relx=0.45, rely=0.2)
self.depordem_entry = Entry(self.dividaliqida, textvariable=self.depordem)
self.depordem_entry.place(relx=0.68, rely=0.2, relwidth=0.1)
self.bt_calcular4 = Button(self.dividaliqida, text="Calcular", bd=2,
bg='#107db2', fg='white', font=('verdana', 8, 'bold'),
command=self.butaoclick4)
self.bt_calcular4.place(relx=0.1, rely=0.6, relwidth=0.2, relheight=0.3)
self.dliquida = StringVar()
self.resultado4 = Label(self.dividaliqida, textvariable=self.dliquida)
self.resultado4.place(relx=0.25, rely=0.35, relwidth=0.1)
self.lb_dliquida = Label(self.dividaliqida, text="Dívida Líquida:",bg='#dfe3ee', fg='#107db2')
self.lb_dliquida.place(relx=0.05, rely=0.35)
self.lb_text3 = Label(self.dividaliqida, text="A Dívida Líquida é uma métrica "
"que de endividamento de uma companhia.\n"
" Nesse indicador, você consegue ver os tipos de obrigações"
"que uma empresa\n carrega, seja ela de curto ou longo prazo.\n"
" Ela representa a"
" quantidade de dinheiro (disponibilidades) que uma companhia\n"
" precisa ter para zerar sua dívida", bg='#dfe3ee', fg='black')
self.lb_text3.place(relx=0.45, rely=0.4)
# Dívida Bruta
self.dividacp1 = DoubleVar()
self.lb_dividacp1 = Label(self.dividabruta, text="Dívida de Curto Prazo:"
, bg='#dfe3ee', fg='#107db2')
self.lb_dividacp1.place(relx=0.35, rely=0.05)
self.dividacp1_entry = Entry(self.dividabruta, textvariable=self.dividacp1)
self.dividacp1_entry.place(relx=0.55, rely=0.05, relwidth=0.1)
self.dividal1p = DoubleVar()
self.lb_dividalp1 = Label(self.dividabruta, text="Dívida de Longo Prazo: ", bg='#dfe3ee', fg='#107db2')
self.lb_dividalp1.place(relx=0.35, rely=0.2)
self.dividalp2_entry = Entry(self.dividabruta, textvariable=self.dividal1p)
self.dividalp2_entry.place(relx=0.55, rely=0.2, relwidth=0.1)
# Butão
self.bt_calcular5 = Button(self.dividabruta, text="Calcular", bd=2,
bg='#107db2', fg='white', font=('verdana', 8, 'bold'),
command=self.butaoclick5)
self.bt_calcular5.place(relx=0.5, rely=0.6, relwidth=0.15, relheight=0.25)
self.dbruta = StringVar()
self.resultado4 = Label(self.dividabruta, textvariable=self.dbruta)
self.resultado4.place(relx=0.55, rely=0.35, relwidth=0.1)
self.lb_dbruta = Label(self.dividabruta, text="Dívida Bruta:",bg='#dfe3ee', fg='#107db2')
self.lb_dbruta.place(relx=0.35, rely=0.35)
# Butões Frame 2
def butaoclick3(self):
divpa = self.dividendopacao.get()
pa = self.precoaccao.get()
rdy = divpa / pa
rdy1 = rdy * 100
rady = round(rdy1, 2)
return self.dy.set(rady)
def butaoclick4(self):
divcp = self.dividacp.get()
divlp = self.dividalp.get()
caixa = self.disponibilidades.get()
dep = self.depordem.get()
disp = caixa + dep
divt = divcp + divlp
# Dívida Líquida = Volume de dívidas - Disponibilidades
dliquida = divt - disp
return self.dliquida.set(dliquida)
def butaoclick5(self):
divcp1 = self.dividacp1.get()
divlp1 = self.dividal1p.get()
divtotal = divcp1 + divlp1
return self.dbruta.set(divtotal)
# Butão para os sites frame 2
def sitedividend_yield(self):
new = 2
url = "https://maisretorno.com/blog/termos/d/dividend-yield"
webbrowser.open(url, new=new)
def sitedivili(self):
new = 2
url = "https://br.investing.com/analysis/buggpedia-o-que-e-a-divida-liquida-net-debt-200226064"
webbrowser.open(url, new=new)
def sitedivbruta(self):
new = 2
url = "https://maisretorno.com/blog/termos/d/divida-bruta"
webbrowser.open(url, new=new)
def sitelegis(self):
new = 2
url = "https://www.cmvm.pt/pt/" \
"Legislacao/Legislacaonacional/CodigodosValoresMobiliarios/Pages/" \
"Codigo-dos-Valores-Mobiliarios.aspx?pg"
webbrowser.open(url, new=new)
def sitecmvm(self):
new = 2
url = "https://www.cmvm.pt/pt/Pages/home.aspx"
webbrowser.open(url, new=new)
def sitecmvm(self):
new = 2
url = "https://www.cmvm.pt/_layouts/15/start.aspx#/Pages/redirect.aspx"
webbrowser.open(url, new=new)
def sitecmvmlegislação(self):
new = 2
url = "https://www.cmvm.pt/pt/Legislacao/" \
"Legislacaonacional/CodigodosValoresMobiliarios" \
"/Pages/Codigo-dos-Valores-Mobiliarios.aspx?pg"
webbrowser.open(url, new=new)
def sitediv(self):
new = 2
url = "https://www.comdinheiro.com.br" \
"/wiki/diferenca-entre-divida-bruta-e-divida-liquida/"
webbrowser.open(url, new=new)
def Quit(self):
self.root.destroy()
def Menus(self):
menubar = Menu(self.root)
self.root.config(menu=menubar)
filemenu = Menu(menubar)
filemenu2 = Menu(menubar)
menubar.add_cascade(label="Opções", menu=filemenu)
filemenu.add_command(label="CMVM", command=self.sitecmvm)
filemenu.add_command(label="Legislação do mercado valores mobiliários",command=self.sitecmvmlegislação)
filemenu.add_command(label="Dívida Líquida VS Dívida Bruta ", command=self.sitediv)
filemenu.add_command(label="Sair", command=self.Quit)
indicadores()
Comentários
Enviar um comentário