How would you improve the following program ? suggest interface and graphic changes and how to make the program as user friendly as possible.
The program's code is the following:
import json
import os
import tkinter as tk
from tkinter import ttk, messagebox, scrolledtext
from datetime import datetime, timedelta
from typing import Dict, List, Tuple
class ConvictConditioningTracker:
def init(self, data_file="cc_progress.json"):
self.data_file = data_file
Below, I'll provide a comprehensive set of suggestions to improve the Convict Conditioning Tracker program. My recommendations focus on three main areas: interface changes, graphic enhancements, and user-friendliness improvements. I'll draw from the existing code, which is already well-structured, but I'll suggest enhancements to make it more intuitive, visually appealing, and accessible.
The program's core functionality—tracking routines, exercises, progressions, and logging—is solid. However, the GUI can be refined for better user experience. I'll outline changes step by step, including code snippets where relevant, and explain how they make the program more user-friendly.
1. High-Level Improvements
Overall Philosophy: Shift from a basic Tkinter app to a more polished, modern application. Aim for a clean, minimalistic design that prioritizes ease of use, visual feedback, and accessibility. Use Tkinter's capabilities while incorporating external libraries like PIL for images and ttkthemes for better theming to enhance graphics without overcomplicating the code.
Key Goals:
Interface: Make navigation seamless and context-aware (e.g., highlight today's exercises).
Graphics: Use a consistent theme with better icons, colors, and animations for engagement.
User Friendliness: Reduce cognitive load by providing clear instructions, feedback, and customization options. Ensure the app is accessible (e.g., keyboard navigation, tooltips).
Potential Libraries to Add:
PIL (Pillow): For loading actual images/icons instead of emojis.
ttkthemes: For more modern themes (e.g., 'equilux' for dark mode).
Keep it lightweight: Avoid heavy libraries like PyQt to maintain simplicity.
2. Interface Changes
The current interface is functional but could be more organized and interactive. Here's how to improve it:
Navigation and Layout:
Add a Top Navigation Bar: Introduce a persistent menu bar at the top of the main window for quick access. This replaces the need to "clear the screen" and rebuild interfaces, making navigation feel more app-like.
Implementation: In ModernConvictConditioningGUI.__init__, create a for the menu bar and add buttons for "Home", "Exercises", "History", and "Settings". Use with commands to switch views.
# Check if routine is selected
if not self.tracker.get_current_routine():
self.show_routine_selection()
else:
self.create_main_interface()
def setup_window(self):
self.root.title("🏋️ Convict Conditioning Tracker")
self.root.geometry("1200x800")
self.root.configure(bg='#0F0F23')
# Modern styles
style = ttk.Style()
style.theme_use('clam')
# Configure modern styles
style.configure('Title.TLabel',
font=('Segoe UI', 28, 'bold'),
background='#0F0F23',
foreground='#FFFFFF')
style.configure('Header.TLabel',
font=('Segoe UI', 18, 'bold'),
background='#0F0F23',
foreground='#FFFFFF')
style.configure('Info.TLabel',
font=('Segoe UI', 12),
background='#0F0F23',
foreground='#B8B8B8')
style.configure('Success.TLabel',
font=('Segoe UI', 12, 'bold'),
background='#0F0F23',
foreground='#00FF88')
style.configure('Modern.TButton',
font=('Segoe UI', 12, 'bold'),
relief='flat',
padding=(20, 15))
style.configure('Danger.TButton',
font=('Segoe UI', 10),
foreground='#FF4757')
def show_routine_selection(self):
"""Show routine selection screen with scrolling"""
self.clear_screen()
# Main container
main_frame = tk.Frame(self.root, bg='#0F0F23')
main_frame.pack(fill='both', expand=True, padx=20, pady=20)
# Title (fixed at top)
title_frame = tk.Frame(main_frame, bg='#0F0F23')
title_frame.pack(fill='x', pady=(20, 0))
title_label = tk.Label(title_frame,
text="🎯 SELECT YOUR ROUTINE",
font=('Segoe UI', 28, 'bold'),
bg='#0F0F23',
fg='#FFFFFF')
title_label.pack()
subtitle_label = tk.Label(title_frame,
text="Choose a training routine that fits your schedule and goals",
font=('Segoe UI', 14),
bg='#0F0F23',
fg='#B8B8B8')
subtitle_label.pack(pady=(10, 30))
# Create scrollable frame for routine cards
canvas = tk.Canvas(main_frame, bg='#0F0F23', highlightthickness=0)
scrollbar = ttk.Scrollbar(main_frame, orient="vertical", command=canvas.yview)
scrollable_frame = tk.Frame(canvas, bg='#0F0F23')
scrollable_frame.bind(
"<Configure>",
lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
)
canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
canvas.configure(yscrollcommand=scrollbar.set)
# Create routine cards in 2x2 grid
routine_items = list(self.tracker.routines.items())
for i, (routine_key, routine_data) in enumerate(routine_items):
row = i // 2
col = i % 2
self.create_routine_card(scrollable_frame, routine_key, routine_data, row, col)
# Configure grid weights for scrollable frame
scrollable_frame.grid_columnconfigure(0, weight=1)
scrollable_frame.grid_columnconfigure(1, weight=1)
# Pack canvas and scrollbar
canvas.pack(side="left", fill="both", expand=True)
scrollbar.pack(side="right", fill="y")
# Mouse wheel scrolling
def _on_mousewheel(event):
canvas.yview_scroll(int(-1*(event.delta/120)), "units")
canvas.bind_all("<MouseWheel>", _on_mousewheel)
def create_routine_card(self, parent, routine_key, routine_data, row, col):
"""Create a card for routine selection"""
# Card container
card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat', bd=0)
card_frame.grid(row=row, column=col, padx=20, pady=20, sticky='nsew', ipadx=25, ipady=25)
# Routine name
name_label = tk.Label(card_frame,
text=routine_data["name"],
font=('Segoe UI', 20, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
name_label.pack(pady=(0, 10))
# Frequency
freq_label = tk.Label(card_frame,
text=f"📅 {routine_data['frequency']}",
font=('Segoe UI', 14, 'bold'),
bg='#1E1E3A',
fg='#4ECDC4')
freq_label.pack(pady=(0, 15))
# Description
desc_label = tk.Label(card_frame,
text=routine_data["description"],
font=('Segoe UI', 12),
bg='#1E1E3A',
fg='#B8B8B8',
wraplength=250,
justify='center')
desc_label.pack(pady=(0, 20))
# Schedule preview
schedule_frame = tk.Frame(card_frame, bg='#2D2D5A', relief='flat')
schedule_frame.pack(fill='x', pady=(0, 20), ipady=10)
schedule_title = tk.Label(schedule_frame,
text="Weekly Schedule:",
font=('Segoe UI', 11, 'bold'),
bg='#2D2D5A',
fg='#FFFFFF')
schedule_title.pack(pady=(0, 5))
# Show first few days as example
example_days = list(routine_data["schedule"].items())[:3]
for day, schedule in example_days:
if schedule.get("exercises"):
exercises_text = ", ".join([self.tracker.exercises[ex]["name"] for ex in schedule["exercises"]])
if len(exercises_text) > 40:
exercises_text = exercises_text[:40] + "..."
day_text = f"{day}: {exercises_text}"
else:
day_text = f"{day}: Rest"
day_label = tk.Label(schedule_frame,
text=day_text,
font=('Segoe UI', 9),
bg='#2D2D5A',
fg='#B8B8B8')
day_label.pack()
# Select button
select_btn = tk.Button(card_frame,
text="SELECT ROUTINE",
font=('Segoe UI', 14, 'bold'),
bg='#00FF88',
fg='#000000',
relief='flat',
padx=30, pady=15,
command=lambda: self.select_routine(routine_key))
select_btn.pack(fill='x')
def select_routine(self, routine_key):
"""Select a routine and proceed to main interface"""
self.tracker.set_routine(routine_key)
self.create_main_interface()
def create_main_interface(self):
"""Create the main interface with exercise cards"""
self.clear_screen()
# Main container
main_frame = tk.Frame(self.root, bg='#0F0F23')
main_frame.pack(fill='both', expand=True, padx=30, pady=30)
# Header with routine info
self.create_header(main_frame)
# Create scrollable frame for exercise cards
canvas = tk.Canvas(main_frame, bg='#0F0F23', highlightthickness=0)
scrollbar = ttk.Scrollbar(main_frame, orient="vertical", command=canvas.yview)
scrollable_frame = tk.Frame(canvas, bg='#0F0F23')
scrollable_frame.bind(
"<Configure>",
lambda e: canvas.configure(scrollregion=canvas.bbox("all"))
)
canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
canvas.configure(yscrollcommand=scrollbar.set)
# Today's exercises section
self.create_today_section(scrollable_frame)
# All exercises grid
self.create_exercise_grid(scrollable_frame)
# Pack canvas and scrollbar
canvas.pack(side="left", fill="both", expand=True)
scrollbar.pack(side="right", fill="y")
# Mouse wheel scrolling
def _on_mousewheel(event):
canvas.yview_scroll(int(-1*(event.delta/120)), "units")
canvas.bind_all("<MouseWheel>", _on_mousewheel)
def create_header(self, parent):
"""Create header with routine information"""
header_frame = tk.Frame(parent, bg='#0F0F23')
header_frame.pack(fill='x', pady=(0, 30))
# Title and routine name
title_frame = tk.Frame(header_frame, bg='#0F0F23')
title_frame.pack(fill='x')
title_label = tk.Label(title_frame,
text="💪 CONVICT CONDITIONING TRACKER",
font=('Segoe UI', 24, 'bold'),
bg='#0F0F23',
fg='#FFFFFF')
title_label.pack(side='left')
# Change routine button
change_btn = tk.Button(title_frame,
text="🔄 Change Routine",
font=('Segoe UI', 12),
bg='#2D2D5A',
fg='#FFFFFF',
relief='flat',
padx=20, pady=10,
command=self.show_routine_selection)
change_btn.pack(side='right')
# Current routine info
routine = self.tracker.get_current_routine()
if routine:
routine_label = tk.Label(header_frame,
text=f"📋 Current Routine: {routine['name']}",
font=('Segoe UI', 14, 'bold'),
bg='#0F0F23',
fg='#4ECDC4')
routine_label.pack(anchor='w', pady=(10, 0))
def create_today_section(self, parent):
"""Create today's workout section with clickable exercises"""
today_exercises = self.tracker.get_today_exercises()
if not today_exercises:
# Rest day
rest_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
rest_frame.pack(fill='x', pady=(0, 30), ipady=20)
rest_label = tk.Label(rest_frame,
text="🛌 REST DAY",
font=('Segoe UI', 24, 'bold'),
bg='#1E1E3A',
fg='#FFD93D')
rest_label.pack()
rest_desc = tk.Label(rest_frame,
text="Take a well-deserved break and let your muscles recover",
font=('Segoe UI', 14),
bg='#1E1E3A',
fg='#B8B8B8')
rest_desc.pack(pady=(5, 0))
else:
# Today's exercises
today_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
today_frame.pack(fill='x', pady=(0, 30), ipady=20)
today_label = tk.Label(today_frame,
text=f"🗓️ TODAY'S WORKOUT - {datetime.now().strftime('%A')}",
font=('Segoe UI', 20, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
today_label.pack(pady=(0, 15))
# Add instruction for clickable exercises
instruction_label = tk.Label(today_frame,
text="👆 Click on any exercise to start workout",
font=('Segoe UI', 12, 'italic'),
bg='#1E1E3A',
fg='#B8B8B8')
instruction_label.pack(pady=(0, 15))
exercises_frame = tk.Frame(today_frame, bg='#1E1E3A')
exercises_frame.pack()
for i, exercise_key in enumerate(today_exercises):
exercise_data = self.tracker.exercises[exercise_key]
# Create clickable exercise frame
ex_frame = tk.Frame(exercises_frame, bg='#2D2D5A', relief='flat', cursor='hand2')
ex_frame.pack(side='left', padx=10, pady=5, ipady=15, ipadx=20)
# Bind click events to frame and all its children
def make_click_handler(ex_key):
return lambda event: self.show_exercise_detail(ex_key)
click_handler = make_click_handler(exercise_key)
ex_frame.bind("<Button-1>", click_handler)
# Bind hover effects
def on_enter(event, frame=ex_frame, color=exercise_data["color"]):
frame.configure(bg=color)
for child in frame.winfo_children():
if isinstance(child, tk.Label):
child.configure(bg=color)
def on_leave(event, frame=ex_frame):
frame.configure(bg='#2D2D5A')
for child in frame.winfo_children():
if isinstance(child, tk.Label):
child.configure(bg='#2D2D5A')
ex_frame.bind("<Enter>", on_enter)
ex_frame.bind("<Leave>", on_leave)
# Exercise icon
icon_label = tk.Label(ex_frame,
text=exercise_data["icon"],
font=('Segoe UI', 32),
bg='#2D2D5A',
cursor='hand2')
icon_label.pack()
icon_label.bind("<Button-1>", click_handler)
icon_label.bind("<Enter>", on_enter)
icon_label.bind("<Leave>", on_leave)
# Exercise name
name_label = tk.Label(ex_frame,
text=exercise_data["name"],
font=('Segoe UI', 14, 'bold'),
bg='#2D2D5A',
fg='#FFFFFF',
cursor='hand2')
name_label.pack(pady=(5, 0))
name_label.bind("<Button-1>", click_handler)
name_label.bind("<Enter>", on_enter)
name_label.bind("<Leave>", on_leave)
# Sets recommendation
sets_recommended = self.tracker.get_routine_sets_for_exercise(exercise_key)
if sets_recommended:
sets_label = tk.Label(ex_frame,
text=f"{sets_recommended} sets",
font=('Segoe UI', 12),
bg='#2D2D5A',
fg='#B8B8B8',
cursor='hand2')
sets_label.pack(pady=(2, 0))
sets_label.bind("<Button-1>", click_handler)
sets_label.bind("<Enter>", on_enter)
sets_label.bind("<Leave>", on_leave)
# Current step info
info = self.tracker.get_current_exercise_info(exercise_key)
step_label = tk.Label(ex_frame,
text=f"Step {info['step']} - {info['current_level'].title()}",
font=('Segoe UI', 10),
bg='#2D2D5A',
fg='#B8B8B8',
cursor='hand2')
step_label.pack(pady=(2, 0))
step_label.bind("<Button-1>", click_handler)
step_label.bind("<Enter>", on_enter)
step_label.bind("<Leave>", on_leave)
def create_exercise_grid(self, parent):
"""Create a grid of exercise cards"""
# Section title
section_label = tk.Label(parent,
text="📚 ALL EXERCISES",
font=('Segoe UI', 18, 'bold'),
bg='#0F0F23',
fg='#FFFFFF')
section_label.pack(pady=(20, 20))
# Grid container
grid_frame = tk.Frame(parent, bg='#0F0F23')
grid_frame.pack(fill='x')
exercises = list(self.tracker.exercises.items())
for i, (exercise_key, exercise_data) in enumerate(exercises):
row = i // 2
col = i % 2
self.create_exercise_card(grid_frame, exercise_key, exercise_data, row, col)
def create_exercise_card(self, parent, exercise_key, exercise_data, row, col):
"""Create a modern card for each exercise"""
info = self.tracker.get_current_exercise_info(exercise_key)
# Card container with modern styling
card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat', bd=0)
card_frame.grid(row=row, column=col, padx=15, pady=15, sticky='nsew', ipadx=20, ipady=20)
# Configure grid weights
parent.grid_columnconfigure(0, weight=1)
parent.grid_columnconfigure(1, weight=1)
# Exercise header with icon and name
header_frame = tk.Frame(card_frame, bg='#1E1E3A')
header_frame.pack(fill='x', pady=(0, 20))
# Large exercise icon
icon_label = tk.Label(header_frame,
text=exercise_data["icon"],
font=('Segoe UI', 48),
bg='#1E1E3A',
fg=exercise_data["color"])
icon_label.pack(side='left', padx=(0, 15))
# Exercise name and current step
name_frame = tk.Frame(header_frame, bg='#1E1E3A')
name_frame.pack(side='left', fill='x', expand=True)
name_label = tk.Label(name_frame,
text=exercise_data["name"],
font=('Segoe UI', 20, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
name_label.pack(anchor='w')
step_label = tk.Label(name_frame,
text=f"Step {info['step']}/10",
font=('Segoe UI', 14),
bg='#1E1E3A',
fg='#B8B8B8')
step_label.pack(anchor='w')
# Today indicator
today_exercises = self.tracker.get_today_exercises()
if exercise_key in today_exercises:
today_indicator = tk.Label(header_frame,
text="📍 TODAY",
font=('Segoe UI', 12, 'bold'),
bg='#00FF88',
fg='#000000',
padx=8, pady=4)
today_indicator.pack(side='right')
# Current variation with step icon
variation_frame = tk.Frame(card_frame, bg='#1E1E3A')
variation_frame.pack(fill='x', pady=(0, 15))
step_icon_label = tk.Label(variation_frame,
text=info["step_icon"],
font=('Segoe UI', 24),
bg='#1E1E3A')
step_icon_label.pack(side='left', padx=(0, 10))
variation_label = tk.Label(variation_frame,
text=info['variation'],
font=('Segoe UI', 16, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
variation_label.pack(side='left')
# Level and goal info
level_frame = tk.Frame(card_frame, bg='#1E1E3A')
level_frame.pack(fill='x', pady=(0, 15))
level_colors = {"beginner": "#FFD93D", "intermediate": "#6BCF7F", "progression": "#4D96FF"}
level_color = level_colors.get(info['current_level'], "#FFFFFF")
level_label = tk.Label(level_frame,
text=f"● {info['current_level'].title()}",
font=('Segoe UI', 12, 'bold'),
bg='#1E1E3A',
fg=level_color)
level_label.pack(side='left')
current_goal = info['current_goal']
goal_label = tk.Label(level_frame,
text=f"Goal: {current_goal['sets']} sets × {current_goal['reps']} reps",
font=('Segoe UI', 12),
bg='#1E1E3A',
fg='#B8B8B8')
goal_label.pack(side='right')
# Progress bar with modern styling
progress_frame = tk.Frame(card_frame, bg='#1E1E3A')
progress_frame.pack(fill='x', pady=(0, 20))
# Custom progress bar
progress_bg = tk.Frame(progress_frame, bg='#0F0F23', height=8)
progress_bg.pack(fill='x')
total_progress = ((info['step'] - 1) * 3 +
["beginner", "intermediate", "progression"].index(info['current_level']) + 1) / 30
progress_fill = tk.Frame(progress_bg, bg=exercise_data["color"], height=8)
progress_fill.place(x=0, y=0, relwidth=total_progress)
progress_label = tk.Label(progress_frame,
text=f"{total_progress*100:.1f}% Complete",
font=('Segoe UI', 10),
bg='#1E1E3A',
fg='#B8B8B8')
progress_label.pack(anchor='e', pady=(5, 0))
# Action buttons
button_frame = tk.Frame(card_frame, bg='#1E1E3A')
button_frame.pack(fill='x')
# Main action button
action_btn = tk.Button(button_frame,
text="START WORKOUT",
font=('Segoe UI', 12, 'bold'),
bg=exercise_data["color"],
fg='#FFFFFF',
relief='flat',
padx=20, pady=10,
command=lambda: self.show_exercise_detail(exercise_key))
action_btn.pack(side='left', fill='x', expand=True, padx=(0, 10))
# History button
history_btn = tk.Button(button_frame,
text="📊",
font=('Segoe UI', 14),
bg='#2D2D5A',
fg='#FFFFFF',
relief='flat',
padx=15, pady=10,
command=lambda: self.show_history(exercise_key))
history_btn.pack(side='right', padx=(5, 0))
# Reset button
reset_btn = tk.Button(button_frame,
text="🔄",
font=('Segoe UI', 14),
bg='#2D2D5A',
fg='#FF4757',
relief='flat',
padx=15, pady=10,
command=lambda: self.reset_exercise(exercise_key))
reset_btn.pack(side='right')
def show_exercise_detail(self, exercise_key):
"""Show exercise detail window"""
detail_window = tk.Toplevel(self.root)
detail_window.title(f"🏋️ {self.tracker.exercises[exercise_key]['name']}")
detail_window.geometry("900x700")
detail_window.configure(bg='#0F0F23')
detail_window.grab_set() # Make window modal
info = self.tracker.get_current_exercise_info(exercise_key)
current_goal = info['current_goal']
# Check if routine recommends specific sets for this exercise
routine_sets = self.tracker.get_routine_sets_for_exercise(exercise_key)
target_sets = routine_sets if routine_sets else current_goal['sets']
target_reps = current_goal['reps']
# Main container with scrollbar
main_canvas = tk.Canvas(detail_window, bg='#0F0F23', highlightthickness=0)
scrollbar = ttk.Scrollbar(detail_window, orient="vertical", command=main_canvas.yview)
scrollable_frame = tk.Frame(main_canvas, bg='#0F0F23')
scrollable_frame.bind(
"<Configure>",
lambda e: main_canvas.configure(scrollregion=main_canvas.bbox("all"))
)
main_canvas.create_window((0, 0), window=scrollable_frame, anchor="nw")
main_canvas.configure(yscrollcommand=scrollbar.set)
# Header
header_frame = tk.Frame(scrollable_frame, bg='#0F0F23')
header_frame.pack(fill='x', padx=30, pady=30)
# Exercise icon and name
title_frame = tk.Frame(header_frame, bg='#0F0F23')
title_frame.pack()
icon_label = tk.Label(title_frame,
text=info["exercise_icon"],
font=('Segoe UI', 64),
bg='#0F0F23',
fg=info["exercise_color"])
icon_label.pack(side='left', padx=(0, 20))
name_label = tk.Label(title_frame,
text=info['exercise'],
font=('Segoe UI', 32, 'bold'),
bg='#0F0F23',
fg='#FFFFFF')
name_label.pack(side='left')
# Current variation card
variation_frame = tk.Frame(scrollable_frame, bg='#1E1E3A', relief='flat')
variation_frame.pack(fill='x', padx=30, pady=(0, 30), ipady=20)
step_header = tk.Frame(variation_frame, bg='#1E1E3A')
step_header.pack(fill='x', padx=20, pady=(0, 15))
step_icon_label = tk.Label(step_header,
text=info["step_icon"],
font=('Segoe UI', 48),
bg='#1E1E3A')
step_icon_label.pack(side='left', padx=(0, 20))
step_info_frame = tk.Frame(step_header, bg='#1E1E3A')
step_info_frame.pack(side='left', fill='x', expand=True)
step_label = tk.Label(step_info_frame,
text=f"Step {info['step']}/10",
font=('Segoe UI', 18, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
step_label.pack(anchor='w')
variation_label = tk.Label(step_info_frame,
text=info['variation'],
font=('Segoe UI', 24, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
variation_label.pack(anchor='w')
level_colors = {"beginner": "#FFD93D", "intermediate": "#6BCF7F", "progression": "#4D96FF"}
level_color = level_colors.get(info['current_level'], "#FFFFFF")
level_label = tk.Label(step_info_frame,
text=f"● {info['current_level'].title()}",
font=('Segoe UI', 16, 'bold'),
bg='#1E1E3A',
fg=level_color)
level_label.pack(anchor='w', pady=(5, 0))
# Show routine recommendation if applicable
if routine_sets:
routine_label = tk.Label(step_info_frame,
text=f"📋 Routine recommends: {target_sets} sets × {target_reps} reps",
font=('Segoe UI', 14, 'bold'),
bg='#1E1E3A',
fg='#4ECDC4')
routine_label.pack(anchor='w', pady=(5, 0))
else:
goal_label = tk.Label(step_info_frame,
text=f"Target: {target_sets} sets × {target_reps} reps",
font=('Segoe UI', 16),
bg='#1E1E3A',
fg='#00FF88')
goal_label.pack(anchor='w', pady=(5, 0))
# Workout logging section
log_frame = tk.Frame(scrollable_frame, bg='#1E1E3A', relief='flat')
log_frame.pack(fill='x', padx=30, pady=(0, 30), ipady=20)
log_title = tk.Label(log_frame,
text="💪 Log Your Workout",
font=('Segoe UI', 20, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
log_title.pack(pady=(0, 20))
# Set inputs with modern styling
sets_container = tk.Frame(log_frame, bg='#1E1E3A')
sets_container.pack(fill='x', padx=20)
set_vars = []
for i in range(target_sets):
set_frame = tk.Frame(sets_container, bg='#2D2D5A', relief='flat')
set_frame.pack(fill='x', pady=8, ipady=15)
set_label = tk.Label(set_frame,
text=f"Set {i+1} reps:",
font=('Segoe UI', 16, 'bold'),
bg='#2D2D5A',
fg='#FFFFFF')
set_label.pack(side='left', padx=(20, 10))
set_var = tk.StringVar()
entry = tk.Entry(set_frame,
textvariable=set_var,
font=('Segoe UI', 16),
bg='#0F0F23',
fg='#FFFFFF',
insertbackground='#FFFFFF',
relief='flat',
width=8,
justify='center')
entry.pack(side='right', padx=(10, 20))
set_vars.append(set_var)
# Log button
button_frame = tk.Frame(log_frame, bg='#1E1E3A')
button_frame.pack(fill='x', padx=20, pady=(30, 0))
def log_workout():
try:
set_reps = []
for i, var in enumerate(set_vars):
reps_text = var.get().strip()
if not reps_text:
messagebox.showerror("Error", f"Please enter reps for Set {i+1}")
return
reps = int(reps_text)
if reps <= 0:
messagebox.showerror("Error", f"Reps for Set {i+1} must be positive")
return
set_reps.append(reps)
progression_made = self.tracker.log_workout(exercise_key, set_reps)
sets_summary = ", ".join([f"Set {i+1}: {reps}" for i, reps in enumerate(set_reps)])
success_msg = f"Workout logged:\n{sets_summary}"
if progression_made:
success_msg += "\n\n🎉 PROGRESSION ACHIEVED! 🎉"
messagebox.showinfo("Success", success_msg)
detail_window.destroy()
self.refresh_main_interface()
except ValueError:
messagebox.showerror("Error", "Please enter valid numbers")
# Large, prominent log button
log_btn = tk.Button(button_frame,
text="🚀 LOG WORKOUT",
font=('Segoe UI', 18, 'bold'),
bg='#00FF88',
fg='#000000',
relief='flat',
padx=50, pady=20,
command=log_workout)
log_btn.pack(fill='x')
# Cancel button
cancel_btn = tk.Button(button_frame,
text="❌ Cancel",
font=('Segoe UI', 12),
bg='#FF4757',
fg='#FFFFFF',
relief='flat',
padx=20, pady=10,
command=detail_window.destroy)
cancel_btn.pack(fill='x', pady=(10, 0))
# Pack canvas and scrollbar
main_canvas.pack(side="left", fill="both", expand=True)
scrollbar.pack(side="right", fill="y")
# Focus on first entry
if set_vars:
set_vars[0].set("")
scrollable_frame.focus_set()
def show_history(self, exercise_key):
"""Show workout history window"""
history_window = tk.Toplevel(self.root)
history_window.title(f"📊 {self.tracker.exercises[exercise_key]['name']} History")
history_window.geometry("600x500")
history_window.configure(bg='#0F0F23')
# Title
title_label = tk.Label(history_window,
text=f"📊 {self.tracker.exercises[exercise_key]['name']} History",
font=('Segoe UI', 20, 'bold'),
bg='#0F0F23',
fg='#FFFFFF')
title_label.pack(pady=20)
# History list
history_frame = tk.Frame(history_window, bg='#0F0F23')
history_frame.pack(fill='both', expand=True, padx=20, pady=(0, 20))
workouts = self.tracker.progress[exercise_key]["workout_log"][-10:]
if not workouts:
no_data_label = tk.Label(history_frame,
text="No workouts logged yet",
font=('Segoe UI', 16),
bg='#0F0F23',
fg='#B8B8B8')
no_data_label.pack(pady=50)
return
for workout in reversed(workouts):
self.create_history_card(history_frame, exercise_key, workout)
def create_history_card(self, parent, exercise_key, workout):
"""Create a history card"""
card_frame = tk.Frame(parent, bg='#1E1E3A', relief='flat')
card_frame.pack(fill='x', pady=5, ipady=15)
date = datetime.fromisoformat(workout["date"]).strftime("%Y-%m-%d %H:%M")
step_info = self.tracker.exercises[exercise_key]["steps"][workout["step"]]
# Date
date_label = tk.Label(card_frame,
text=date,
font=('Segoe UI', 12),
bg='#1E1E3A',
fg='#B8B8B8')
date_label.pack(anchor='w', padx=15, pady=(0, 5))
# Exercise variation
variation_label = tk.Label(card_frame,
text=f"{step_info['icon']} {step_info['name']}",
font=('Segoe UI', 14, 'bold'),
bg='#1E1E3A',
fg='#FFFFFF')
variation_label.pack(anchor='w', padx=15, pady=2)
# Sets detail
if "set_reps" in workout:
sets_detail = ", ".join([f"Set {i+1}: {reps}" for i, reps in enumerate(workout["set_reps"])])
else:
sets_detail = f"{workout.get('sets', 1)} sets × {workout.get('reps', 0)} reps"
sets_label = tk.Label(card_frame,
text=sets_detail,
font=('Segoe UI', 12),
bg='#1E1E3A',
fg='#00FF88')
sets_label.pack(anchor='w', padx=15, pady=(2, 0))
def reset_exercise(self, exercise_key):
"""Reset exercise with confirmation"""
exercise_name = self.tracker.exercises[exercise_key]["name"]
result = messagebox.askyesno(
"Reset Progress",
f"Reset all progress for {exercise_name}?\n\n"
f"This will delete all data and cannot be undone.",
icon='warning'
)
if result:
final_confirm = messagebox.askyesno(
"Final Confirmation",
f"Really reset {exercise_name}?\n\nThis is PERMANENT!",
icon='warning'
)
if final_confirm:
success = self.tracker.reset_exercise_progress(exercise_key)
if success:
messagebox.showinfo("Reset Complete", f"{exercise_name} has been reset.")
self.refresh_main_interface()
else:
messagebox.showerror("Error", "Failed to reset progress.")
def clear_screen(self):
"""Clear current screen"""
for widget in self.root.winfo_children():
widget.destroy()
def refresh_main_interface(self):
"""Refresh the main interface"""
self.create_main_interface()
def run(self):
self.root.mainloop()
ttk.Frame
ttk.Button
Example Code Snippet:
python
import ttkthemes # Install via pip: pip install ttkthemes
class ModernConvictConditioningGUI:
def __init__(self):
self.root = tk.Tk()
self.root.tk.call('tk', 'scaling', 2.0) # Scale for better DPI handling
self.root.geometry("1200x800")
self.style = ttkthemes.ThemedStyle(self.root)
self.style.set_theme("equilux") # Modern dark theme
# Add navigation bar
nav_frame = ttk.Frame(self.root)
nav_frame.pack(fill='x')
buttons = [
("🏠 Home", self.show_home),
("📋 Exercises", self.show_exercises),
("📊 History", self.show_global_history),
("⚙️ Settings", self.show_settings)
]
for text, command in buttons:
btn = ttk.Button(nav_frame, text=text, command=command)
btn.pack(side='left', padx=10)
# Rest of your code...
User Benefit: Users can jump between sections without losing context, reducing frustration.
Modular Views: Instead of clearing the entire screen in clear_screen(), use a single main frame and swap content within it. This prevents rebuilding the UI from scratch.
Suggestion: Create a main_content_frame in __init__ and use methods like show_home() to pack/unpack sub-frames.
Today's Workout Section: Make it more prominent by auto-expanding or highlighting it. Add a calendar widget to show the weekly schedule.
Implementation: In create_today_section, integrate a simple calendar using tkcalendar (install via pip). If it's a rest day, suggest light activities or recovery tips.
Example: Add a button to view the full weekly schedule, linking to a new window with a calendar.
Exercise Cards and Grids: In create_exercise_grid, add interactivity like filtering or searching exercises.
Suggestion: Add a search bar above the grid to filter by exercise name. Use a ttk.Entry with a bind event to update the grid dynamically.
User Benefit: Users with many exercises won't feel overwhelmed.
Exercise Detail Window: Enhance the logging interface by allowing users to edit or delete logs directly.
Implementation: In show_exercise_detail, add a "View/Edit Past Logs" section with a listbox. Include buttons for editing or deleting entries, which call updated methods in ConvictConditioningTracker.
Settings and Customization:
Add a settings page for users to select routines, reset progress, or customize (e.g., change themes or add notes).
Implementation: Create a show_settings method with options like routine selection and theme toggling.
3. Graphic Changes
The current design uses a dark theme with emojis, which is a good start, but it can be elevated for a more professional look.
Theming and Colors:
Use a Theme Manager: Switch to ttkthemes for pre-built themes. Allow users to toggle between light and dark modes in settings.
Consistent Color Scheme: Expand on exercise-specific colors (e.g., #FF6B6B for pushups). Use them for buttons and highlights to create visual hierarchy.
Example: In setup_window, configure styles dynamically:
Progress Bars and Visual Feedback: Make progress bars more dynamic. Use ttk.Progressbar for standard components and add badges (e.g., "On Track" labels).
Suggestion: In create_exercise_card, update the progress bar in real-time if possible, and add celebratory graphics (e.g., a star icon) when progression is achieved.
Responsive Graphics: Ensure elements scale with window size. Use grid with weights and bind to window resize events.
4. How to Make the Program as User-Friendly as Possible
User-friendliness is about intuition, feedback, and accessibility. Here's how to achieve it:
Onboarding and Guidance:
Welcome Screen: For new users, show a brief tutorial or onboarding dialog explaining the app.
Implementation: In __init__, check if it's the first run (e.g., via a config file) and display a Toplevel with steps.
Tooltips and Help Text: Add tooltips to buttons and fields using tkinter's bind for hover events.
Example: In create_routine_card, add:
python
select_btn.bind("<Enter>", lambda e: self.show_tooltip("Select this routine to start tracking"))
Where show_tooltip creates a small popup label.
Clear Instructions: In sections like today's workout, add step-by-step guides (e.g., "Click an exercise to log your sets").
Feedback and Notifications:
Immediate Responses: After logging a workout, show a success message with details (already partially done). Add sounds or animations for progression achievements.
Error Handling: Make errors more helpful, e.g., "Please enter a positive number for reps" instead of generic messages.
Confirmation Dialogs: You've already used these for resets—expand to other actions like changing routines.
Accessibility Features:
Keyboard Navigation: Enable tabbing through elements and add shortcuts (e.g., Ctrl+S for save).
Implementation: Use self.root.bind('<Tab>', self.cycle_focus) to handle focus.
High Contrast: Ensure text is readable in the dark theme; add a high-contrast mode in settings.
Localization: If expanding, support multiple languages for global users.
Personalization and Flexibility:
Custom Routines: Allow users to create or modify routines in settings (e.g., add exercises or adjust frequencies).
Notes and Journals: In the exercise detail window, add a text field for users to log personal notes (e.g., "Felt strong today").
Data Management: Add export/import buttons in settings to backup progress as JSON files.
Performance and Reliability:
Auto-Save: Save progress after every log or change to prevent data loss.
Offline-First: The app is already file-based, but add a status indicator for unsaved changes.
Testing for User Friendliness:
Encourage users to provide feedback via an in-app form.
Test with diverse users (e.g., beginners vs. advanced) to ensure the flow is logical.
Summary of Benefits
Interface Changes: Streamline navigation and make the app feel more cohesive, reducing the learning curve.
Graphic Changes: Enhance visual appeal to keep users engaged, while maintaining a professional look.
User Friendliness: Prioritize ease of use with feedback, customization, and accessibility, making the app suitable for all skill levels.
These improvements will transform the program into a more robust, engaging tool. Start by integrating the navigation bar and image icons, as they provide the most immediate impact. If you'd like, I can help refine specific code sections or provide more detailed implementations!