Component: bravura.components.glass_panels.GlassPanel
Status: ✅ Production Ready
License Tiers: Professional, Enterprise
Last Updated: October 17, 2025
---
The Glass Panel component creates premium depth cards with frosted glass effects, layered shadows, and smooth hover animations. It provides visual hierarchy and professional polish aligned with the Wigley Studios design system.
---
import tkinter as tk
from bravura.themes.theme_manager import ProfessionalThemeManager
from bravura.components.glass_panels import GlassPanel
class MyApp:
def __init__(self):
self.root = tk.Tk()
self.root.title("My App with Glass Panels")
self.root.geometry("800x600")
# Initialize theme manager FIRST
self.theme_manager = ProfessionalThemeManager(self)
self.theme_manager.apply_theme("wigley_site")
# Create glass panel with theme colors
glass_panel = GlassPanel(
parent=self.root,
tokens=self.theme_manager.get_current_theme_colors(),
elevation="card"
)
glass_panel.pack(fill="both", expand=True, padx=20, pady=20)
# Add content to the panel
content_area = glass_panel.get_content_area()
# Add widgets to content area
tk.Label(content_area, text="Glass Panel Content",
font=("Segoe UI", 14)).pack(pady=20)
tk.Button(content_area, text="Sample Button").pack(pady=10)
if __name__ == "__main__":
app = MyApp()
app.root.mainloop()
---
| Elevation | Use Case | Visual Effect | Shadow Intensity |
|---|---|---|---|
| `"card"` | Standard content cards | Subtle elevation | Light shadows |
| `"elevated"` | Important sections | Moderate elevation | Medium shadows |
| `"modal"` | Dialogs, overlays | High elevation | Strong shadows |
| `"floating"` | Tooltips, popups | Maximum elevation | Very strong shadows |
# For subtle UI elements (recommended for typical usage)
card_panel = GlassPanel(parent, elevation="card")
# For important sections
elevated_panel = GlassPanel(parent, elevation="elevated")
# For modal dialogs
modal_panel = GlassPanel(parent, elevation="modal")
# For floating elements
floating_panel = GlassPanel(parent, elevation="floating")
---
# Custom glass panel with specific settings
glass_panel = GlassPanel(
parent=parent_widget,
tokens=theme_tokens,
elevation="card",
hover_elevation=True, # Enable hover effects
animated=False, # Disable entrance animations
padding=16, # Custom padding
corner_radius=8 # Custom corner radius
)
# Get current theme colors
theme_tokens = theme_manager.get_current_theme_colors()
# Create panel with theme colors
glass_panel = GlassPanel(
parent=parent,
tokens=theme_tokens,
elevation="card"
)
---
✅ Good Use Cases:
❌ Avoid For:
elevation="card" for most UI elements---
# Main dashboard with glass panels
main_frame = tk.Frame(root)
# Statistics cards
stats_frame = tk.Frame(main_frame)
for i in range(4):
card = GlassPanel(
stats_frame,
tokens=theme_tokens,
elevation="card"
)
card.grid(row=0, column=i, padx=10, pady=10, sticky="ew")
# Add content to card
content = card.get_content_area()
tk.Label(content, text=f"Card {i+1}").pack(pady=10)
# Main content area
content_panel = GlassPanel(
main_frame,
tokens=theme_tokens,
elevation="elevated"
)
content_panel.pack(fill="both", expand=True, padx=20, pady=20)
def show_modal():
modal = tk.Toplevel(root)
modal.title("Modal Dialog")
modal.geometry("400x300")
# Create glass panel for modal content
glass_panel = GlassPanel(
modal,
tokens=theme_tokens,
elevation="modal"
)
glass_panel.pack(fill="both", expand=True, padx=20, pady=20)
# Add content
content = glass_panel.get_content_area()
tk.Label(content, text="Modal Content").pack(pady=20)
from bravura.components import create_toast_center
# Create toast center with premium style (Pro/Enterprise only)
toast_center = create_toast_center(
root,
theme_tokens,
default_style="premium" # Uses GlassPanel internally
)
# Show premium glass panel toast
toast_center.show(
"Premium notification",
sub_message="With frosted glass effect",
kind="success",
style="premium"
)
---
Glass panel appears too strong/intense:
elevation="card" instead of higher elevationsttk.LabelFrame for subtle UI elementsPerformance issues with many glass panels:
animated=False to disable entrance animationsTheme colors not applying:
tokens=theme_manager.get_current_theme_colors()"bad window path name" errors:
glass_panel.destroy() instead of glass_panel.pack_forget()---
GlassPanel(
parent: tk.Widget,
tokens: Optional[Dict[str, Any]] = None,
theme_tokens: Optional[Dict[str, Any]] = None, # Alias for tokens
elevation: str = "card",
hover_elevation: bool = True,
animated: bool = False,
**kwargs: Any
) -> GlassPanel
# Get content area for adding widgets
content_area = glass_panel.get_content_area()
# Change elevation dynamically
glass_panel.set_elevation("elevated")
# Add content using factory function
widget = glass_panel.add_content(lambda: tk.Button(None, text="Button"))
# Proper cleanup
glass_panel.destroy()
---
# Old approach
frame = ttk.LabelFrame(parent, text="Content", padding=10)
tk.Label(frame, text="Content").pack()
# New approach with glass panel
glass_panel = GlassPanel(parent, tokens=theme_tokens, elevation="card")
content = glass_panel.get_content_area()
tk.Label(content, text="Content").pack()
# Old approach
canvas = tk.Canvas(parent, bg="#1a1a1a", highlightthickness=0)
# Manual drawing code...
# New approach
glass_panel = GlassPanel(parent, tokens=theme_tokens, elevation="card")
content = glass_panel.get_content_area()
# Add widgets to content area
---
Professional Tier: Basic glass panel functionality
Enterprise Tier: All features including custom elevations and animations
For licensing questions, contact sales@wigleystudios.com
---
Copyright (c) 2025 Wigley Studios LLC. All rights reserved.