How to Build an Efficient Desktop Launcher App Using Python and Tkinter?
Description:
In this tutorial, we’ll create a simple yet powerful desktop launcher application using Python and Tkinter. This launcher allows you to open your favorite apps and websites with the click of a button, saving time and making your workflow more efficient. Whether you’re a beginner or a seasoned developer, this step-by-step guide will walk you through building a user-friendly desktop app that looks great and functions seamlessly.
If you’ve been looking for a way to automate your daily tasks and access your most-used apps with ease, this is the perfect project to get started. We’ll also include additional customization options and ideas for enhancing the functionality of your launcher. Let’s dive in!
Full Python Code:
The complete code for creating the desktop launcher can be found below. This script includes buttons for opening commonly used applications like Microsoft Edge, Notepad, Excel, and more, as well as websites like Facebook, Gmail, and LinkedIn.
# Import necessary modules
import tkinter as tk # For creating a graphical user interface (GUI)
import os # For opening local applications
import webbrowser # For opening URLs in a web browser
# Define functions to open specific applications
def open_msedge():
# Open Microsoft Edge browser
os.startfile(r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")
def open_outlook():
# Open Microsoft Outlook
os.startfile(r"C:\Program Files\Microsoft Office\root\Office16\outlook.exe")
def open_notepad():
# Open Notepad application
os.startfile("notepad.exe")
def open_notepadpp():
# Open Notepad++ application
os.startfile("notepad++.exe")
def open_excel_file():
# Open a specific Excel file (provide the correct file path)
os.startfile(r"Write here the excel file path")
def open_excel_file1():
# Open the Microsoft Excel application
os.startfile(r"C:\Program Files\Microsoft Office\root\Office16\excel.exe")
def open_chrome():
# Open Google Chrome browser
os.startfile("chrome.exe")
def open_calc():
# Open the Calculator application
os.startfile(r"C:\Windows\SysWOW64\calc.exe")
def open_acrobat():
# Open Adobe Acrobat Reader
os.startfile(r"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe")
def open_website(url):
# Open a specified website URL using the default web browser
webbrowser.open(url)
# Function to open multiple applications and websites at once
def open_all():
# Open all the defined applications and websites in one go
open_msedge()
open_notepad()
open_notepadpp()
open_excel_file()
open_excel_file1()
open_chrome()
open_calc()
open_acrobat()
open_outlook()
open_website("https://facebook.com/")
open_website("https://web.whatsapp.com/")
open_website("https://mail.google.com/")
open_website("https://chatgpt.com/")
open_website("https://translate.google.com/")
open_website("https://www.linkedin.com/")
# Create the main window for the application
window = tk.Tk()
window.geometry("355x560") # Set the window size
window.title("All Apps") # Set the window title
# Set background color to black for a digital display appearance
window.configure(bg="black")
# Create a label for the application list with 3D effect
label1 = tk.Label(window, text="All Apps", font=("Arial", 18), fg="White", bg="black", relief=tk.RAISED, bd=3)
label1.grid(column=0, row=0, columnspan=3, pady=10) # Position the label at the top center
# Function to create buttons with consistent styles and 3D appearance
def create_button(text, command=None, row=0, column=0, columnspan=1, width=10, height=3, color="gray", fg_color="white"):
# Create a button with the specified properties
button = tk.Button(window, text=text, bg=color, fg=fg_color, command=command,
relief=tk.RAISED, bd=6, font=("Arial", 12),
width=width, height=height)
# Place the button in the grid at the specified location
button.grid(row=row, column=column, columnspan=columnspan, padx=5, pady=5, sticky=tk.W + tk.E)
# Create a "Master" button to open all applications and websites at once
create_button("Master Button", open_all, 1, 0, columnspan=3, width=35, height=2, color="yellow", fg_color="black")
# Create individual buttons for each application and website
create_button("Edge", open_msedge, 2, 0, color="purple")
create_button("Acrobat", open_acrobat, 2, 1, color="orange", fg_color="black")
create_button("Notepad", open_notepad, 2, 2, color="brown")
create_button("Notepad++", open_notepadpp, 3, 0, color="violet")
create_button("Chrome", open_chrome, 3, 1, color="red")
create_button("Calculator", open_calc, 3, 2, color="pink", fg_color="black")
create_button("Facebook", lambda: open_website("https://facebook.com/"), 4, 0, color="light blue", fg_color="black")
create_button("WhatsApp", lambda: open_website("https://web.whatsapp.com/"), 4, 1, color="gray")
create_button("Gmail", lambda: open_website("https://mail.google.com/"), 4, 2, color="blue")
create_button("ChatGPT", lambda: open_website("https://chatgpt.com/"), 5, 0, color="white", fg_color="black")
create_button("Outlook", open_outlook, 5, 1, color="navy blue")
create_button("Excel File", open_excel_file, 5, 2, color="green")
create_button("New Excel", open_excel_file1, 6, 0, color="green")
create_button("Translate", lambda: open_website("https://translate.google.com/"), 6, 1, color="light blue", fg_color="black")
create_button("LinkedIn", lambda: open_website("https://www.linkedin.com/"), 6, 2, color="black", fg_color="white")
# Start the main event loop to display the window and respond to user actions
window.mainloop()
Testimonial:
“I created this Python-based desktop launcher to streamline my daily workflow, and it’s been a game-changer! I used to waste precious time opening multiple applications and websites every morning. Now, with just a single click, I have everything ready to go. The best part? It was surprisingly easy to build using Python and Tkinter. Whether you’re looking to boost your productivity or just want a fun coding project, I highly recommend giving this a try!”
— A passionate System Analyst and Automation Enthusiast, Vinod Gill
Additional Applications You Can Add:
Want to customize your launcher further? Here are some more applications and websites you can easily integrate into your code:
Desktop Applications:
- Microsoft Teams:pythonCopy code
def open_teams(): os.startfile(r"C:\Program Files\Microsoft Teams\current\Teams.exe")
- Visual Studio Code:pythonCopy code
def open_vscode(): os.startfile(r"C:\Users\YourUsername\AppData\Local\Programs\Microsoft VS Code\Code.exe")
- Slack:pythonCopy code
def open_slack(): os.startfile(r"C:\Program Files\Slack\slack.exe")
- Spotify:pythonCopy code
def open_spotify(): os.startfile(r"C:\Users\YourUsername\AppData\Roaming\Spotify\Spotify.exe")
- Zoom:pythonCopy code
def open_zoom(): os.startfile(r"C:\Program Files (x86)\Zoom\bin\Zoom.exe")
Popular Websites:
- YouTube:pythonCopy code
create_button("YouTube", lambda: open_website("https://www.youtube.com/"), row=7, column=0, color="red")
- Google Drive:pythonCopy code
create_button("Google Drive", lambda: open_website("https://drive.google.com/"), row=7, column=1, color="green")
- Twitter:pythonCopy code
create_button("Twitter", lambda: open_website("https://twitter.com/"), row=7, column=2, color="skyblue")
- Reddit:pythonCopy code
create_button("Reddit", lambda: open_website("https://www.reddit.com/"), row=8, column=0, color="orange")