0
Good afternoon Personal,
I am creating a program in python using the Tkinter GUI that use several screens and in the GUI configuration I need to call some text and image files. I would like the help of the gentlemen to find a way to use a variable where I can save the path of the venv directory that are images and text files facilitating the call of these files.
follows an example below of how I am using, but need to create the variable on each screen of the program for the variable to work.
import tkinter as tk
from tkinter import font as tkfont
dir_venv = 'C:\\Users\cs305672\\PycharmProjects\\SACER\\venv'
class StartPage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
imagem = tk.PhotoImage(file=dir_venv+'\\img\\logo_xxx.PNG')
label = tk.Label(self, text="Bem vindo ao sistema de configuração de equipamentos de rede",
font=controller.title_font)
label_logo = tk.Label( self, image=imagem)
label_logo.imagem = imagem
label_logo.pack( side='top', padx=10, pady=10 )
label.pack(side="top", fill="x", pady=5)
lf1 = tk.LabelFrame(self, text="Escolha a marca do equipamento ou serviço que deseja acessar:",
font=("Arial", 15, "bold"), bd=5)
button1 = tk.Button(lf1, text="Cisco", width=15,height=3,font=("Arial", 15, 'bold'),
command=lambda: controller.show_frame("TelaCisco"))
button2 = tk.Button(lf1, text="Orbit", width=15,height=3, font=("Arial", 15, 'bold'),
command=lambda: controller.show_frame("TelaOrbit"))
button3 = tk.Button( lf1, text="Raisecom",width=15,height=3, font=("Arial", 15, 'bold'),
command=lambda: controller.show_frame("TelaRaisecom"))
button4 = tk.Button( lf1, text="Fibra", width=15, height=3, font=("Arial", 15, 'bold'),
command=lambda: controller.show_frame("TelaFibra"))
button1.pack(side='top', fill='x', padx=10, pady=7)
button2.pack(side='top', fill='x', padx=10, pady=7)
button3.pack(side='top', fill='x', padx=10, pady=7)
button4.pack(side='top', fill='x', padx=10, pady=7)
lf1.pack(side='left', fill='both', padx=50, pady=50, ipadx=700, ipady=500 )