hope you all are doing well, if not hopefully tomorrow gets better because you deserve it.
I am having problems joining the label of tkinter to the gui. I am trying to put the asunto label on top left of the asunto textfield, although it was kind of achieved, they are far apart.
Intended GUI
Actual GUI
Here is the code:
def show_personalizado_page():
hide_current_widgets()
root.current_page = "personalizado"
root.title("EvaMailer")
root.geometry("800x600")
# Add the logo
try:
logo_image = Image.open("EvaMailer.png") # Update with your logo path
logo_image = logo_image.resize((100, 100), Image.Resampling.LANCZOS) # Resize with proper resampling filter
logo = ImageTk.PhotoImage(logo_image)
logo_label = tk.Label(root, image=logo)
logo_label.image = logo # Keep a reference to avoid garbage collection
logo_label.grid(row=0, column=1, pady=10, columnspan=2)
except Exception as e:
print(f"Error loading image: {e}")
# Add the 'Regresar' button
def go_back():
show_main_page()
regresar_button = tk.Button(root, text="Regresar", command=go_back)
regresar_button.grid(row=0, column=0, padx=10, pady=10, sticky='w')
# Add the 'Columnas' listbox with a scrollbar
columns_frame = tk.Frame(root)
columns_frame.grid(row=1, column=0, padx=10, pady=10, sticky='ns', rowspan=2)
columns_label = tk.Label(columns_frame, text="Columnas", font=('Arial', 12, 'bold'))
columns_label.pack(anchor='w', padx=10)
columns_listbox = tk.Listbox(columns_frame, height=15)
columns_listbox.pack(side='left', fill='y')
columns_scrollbar = tk.Scrollbar(columns_frame, orient='vertical', command=columns_listbox.yview)
columns_scrollbar.pack(side='right', fill='y')
columns_listbox.config(yscrollcommand=columns_scrollbar.set)
# Add the 'Asunto' entry
subject_label = tk.Label(root, text="Asunto", font=('Arial', 12, 'bold'))
subject_label.grid(row=1, column=1, padx=10, pady=(10, 2), sticky='w')
subject_entry = tk.Entry(root, width=30) # Adjust width for a smaller entry
subject_entry.grid(row=2, column=1, padx=10, pady=(2, 10), sticky='ew')
# Add the 'Cuerpo del Correo' text box
body_label = tk.Label(root, text="Cuerpo del Correo", font=('Arial', 12, 'bold'))
body_label.grid(row=3, column=1, padx=10, pady=5, sticky='w')
body_text = tk.Text(root, height=10, width=60)
body_text.grid(row=4, column=1, padx=10, pady=5, sticky='ew')
# Add 'Enviar' button
sendP_button = tk.Button(root, text="Enviar", command=lambda: print("Enviar button pressed")) # Define button command
sendP_button.grid(row=5, column=1, pady=(20, 10), sticky="e", padx=(10, 5))
# Configure row and column weights to make the layout responsive
root.grid_columnconfigure(1, weight=1)
root.grid_rowconfigure(2, weight=1)
root.grid_rowconfigure(4, weight=1)
root.grid_rowconfigure(5, weight=1)
# Display the available variables as buttons
display_csv_variables()