|
1 | 1 | from tkinter import * |
2 | 2 | from tkinter import Tk, ttk |
| 3 | +from tkinter.ttk import Progressbar |
3 | 4 | from PIL import Image, ImageTk |
| 5 | +from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg |
| 6 | +from matplotlib.figure import Figure |
| 7 | +import matplotlib.pyplot as plt |
4 | 8 |
|
5 | 9 | # ---------- ROOT ------------ ↓ |
6 | 10 | preto = '#000' |
|
50 | 54 | padx=5, relief=RAISED, anchor=CENTER, font='Verdana 14 bold italic', |
51 | 55 | bg=dark1, fg=branco, borderwidth=0) |
52 | 56 | labelLogo.place(x=0, y=0) |
| 57 | + |
| 58 | + |
53 | 59 | # __________________________ POSICIONANDO LOGO NO FRAMETOPO __________________________ ↑ |
54 | 60 |
|
| 61 | +# __________________________ BARRA DE PORCENTAGEM __________________________ ↓ |
55 | 62 |
|
| 63 | +def porcentagem(): |
| 64 | + labelPorcentagem = Label(frameGrafico, text='Porcentagem de gastos', height=1, anchor=NW, |
| 65 | + font=('Verdana 12'), bg=dark1, fg=cinza) |
| 66 | + labelPorcentagem.place(x=40, y=5) |
56 | 67 |
|
| 68 | + style = ttk.Style() |
| 69 | + style.theme_use('default') |
| 70 | + style.configure('black.Horizonal.TProgressbar', background='#59b356') |
| 71 | + style.configure('TProgressbar', thickness=20) |
57 | 72 |
|
58 | | -janela.mainloop() |
| 73 | + barra = Progressbar(frameGrafico, length=188, style='black.Horizontal.TProgressbar') |
| 74 | + barra.place(x=15, y=35) |
| 75 | + barra['value'] = 50 |
| 76 | + |
| 77 | + valor = 50 |
| 78 | + |
| 79 | + labelValor = Label(frameGrafico, text=f'{valor:.1f}%', anchor=NW, font=('Verdana 12'), |
| 80 | + bg=dark1, fg=cinza) |
| 81 | + labelValor.place(x=210, y=35) |
59 | 82 |
|
| 83 | + |
| 84 | +# __________________________ BARRA DE PORCENTAGEM __________________________ ↑ |
| 85 | + |
| 86 | + |
| 87 | +porcentagem() |
| 88 | +janela.mainloop() |
0 commit comments