The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Build a shortcut dashboard with Python

Creating a shortcut dashboard with Python can streamline access to commonly used files, folders, websites, or applications. This can be particularly useful for productivity or workflow automation. Below is a complete guide to building a simple GUI-based shortcut dashboard using Python and Tkinter, with buttons that act as shortcuts.


Python Shortcut Dashboard Using Tkinter

This example dashboard will:

  • Open websites

  • Launch applications

  • Open folders or files

Step 1: Install Required Modules

Only built-in modules are needed. Make sure you’re using Python 3.x.

bash
pip install pillow

(Pillow is optional if you want icons/images.)

Step 2: Create the Dashboard Script

python
import os import webbrowser import tkinter as tk from tkinter import messagebox # Optional: Pillow for icons (only if using image buttons) # from PIL import Image, ImageTk # Define your shortcuts shortcuts = [ {"name": "Google", "type": "web", "target": "https://www.google.com"}, {"name": "YouTube", "type": "web", "target": "https://www.youtube.com"}, {"name": "Documents", "type": "folder", "target": os.path.expanduser("~/Documents")}, {"name": "Notepad", "type": "app", "target": "notepad.exe"}, {"name": "Custom File", "type": "file", "target": os.path.expanduser("~/example.txt")}, ] # Create the main window root = tk.Tk() root.title("Shortcut Dashboard") root.geometry("500x300") root.resizable(False, False) root.configure(bg="#f2f2f2") # Function to handle shortcut actions def open_shortcut(target, type_): try: if type_ == "web": webbrowser.open(target) elif type_ == "folder": os.startfile(target) elif type_ == "file": os.startfile(target) elif type_ == "app": os.system(f'start {target}') else: messagebox.showerror("Error", f"Unknown shortcut type: {type_}") except Exception as e: messagebox.showerror("Failed to open", str(e)) # Create buttons for each shortcut for index, shortcut in enumerate(shortcuts): btn = tk.Button( root, text=shortcut["name"], width=20, height=2, bg="#4CAF50", fg="white", command=lambda s=shortcut: open_shortcut(s["target"], s["type"]) ) btn.grid(row=index//2, column=index%2, padx=20, pady=10) # Run the GUI loop root.mainloop()

Shortcut Types Explained

  • Web: Opens a website in the default browser.

  • Folder: Opens a directory in the system file explorer.

  • File: Opens any file with its default application.

  • App: Launches an installed application by its executable name or path.


Enhancements You Can Add

  • Use icons with PIL.ImageTk for visual dashboard buttons.

  • Make it responsive with grid expansion and dynamic resizing.

  • Save shortcuts to a JSON file for easy user customization.

  • Add categories or a search bar for managing many shortcuts.

  • Use PyQt or Tkinter ttk themes for a more modern interface.


Platform Compatibility

  • Windows: Works with os.startfile() and start commands.

  • macOS/Linux: Replace with open (macOS) or xdg-open (Linux).

Example for macOS:

python
os.system(f"open '{target}'")

Example for Linux:

python
os.system(f"xdg-open '{target}'")

This dashboard is a lightweight, beginner-friendly implementation that can be extended into a more advanced productivity launcher or customized utility hub.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About