responsive-con-solapas

This commit is contained in:
Juanjo 2024-11-28 16:51:42 +01:00
parent 4fe94344e5
commit 3cc5c43dc4
1 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import tkinter as tk import tkinter as tk
from tkinter import Menu from tkinter import Menu # Importar el widget Menu
from tkinter import ttk # Importar el widget ttk
# Crear la ventana principal # Crear la ventana principal
root = tk.Tk() root = tk.Tk()
@ -69,5 +71,17 @@ frame_inferior.grid_propagate(False)
barra_estado = tk.Label(root, text="Barra de estado", bg="lightgray", anchor="w") barra_estado = tk.Label(root, text="Barra de estado", bg="lightgray", anchor="w")
barra_estado.grid(row=1, column=0, columnspan=3, sticky="ew") barra_estado.grid(row=1, column=0, columnspan=3, sticky="ew")
# Notebook para las pestañas
notebook = ttk.Notebook(frame_superior)
notebook.pack(fill="both", expand=True)
# Crear cinco solapas
for i in range(1, 6):
tab = ttk.Frame(notebook)
notebook.add(tab, text=f"Solapa {i}")
# Añadir un Label en cada solapa para diferenciarla
label = ttk.Label(tab, text=f"Contenido de la Solapa {i}")
label.pack(pady=10)
# Ejecución de la aplicación # Ejecución de la aplicación
root.mainloop() root.mainloop()