If you could launch the applications and tools you use every day with just one click, your workflow would become much more efficient, wouldn’t it? This time, I’ll show you how to create your own “simple launcher” using Python’s Tkinter library. With just a few lines of code, you can create a tool that easily launches Notepad, the calculator, or a browser. Moreover, it’s a highly versatile tool that you can customize to register any application or script.
Why is a custom launcher useful?
Improved workflow efficiency
While the Windows Start menu and taskbar are convenient, it can still be a hassle to search for specific tools if you use them frequently. With a custom launcher, you can list the applications you frequently use and launch them with one click, saving you the trouble of searching.
Freedom of customization
A major advantage is that you can freely add or modify menu items to suit your needs. You can also register scripts or batch files to automate tasks, or launch multiple applications at once.
Let’s actually create one
Here, we’ll create a basic launcher using simple code. Using Python and Tkinter, we’ll make it possible to launch three applications (Notepad, the calculator, and a browser) with a single button click. Here’s the code.
Required libraries
We’ll use Python’s standard libraries tkinter
and os
. No special installation is required as long as you have Python installed.
import tkinter as tk from tkinter import messagebox import os # Function to open an application def open_application(app_path): try: os.startfile(app_path) # Open app on Windows except Exception as e: messagebox.showerror("Error", f"Cannot open the application: {e}") # Create Tkinter window root = tk.Tk() root.title("Simple Launcher") root.geometry("300x200") # Adjust size # Set equal row and column sizes root.grid_rowconfigure(0, weight=1) root.grid_rowconfigure(1, weight=1) root.grid_rowconfigure(2, weight=1) root.grid_columnconfigure(0, weight=1) # Create buttons to launch applications app_buttons = { "Notepad": r"notepad.exe", "Calculator": r"calc.exe", "Browser": r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", # Set path correctly, } row = 0 for app_name, app_path in app_buttons.items(): button = tk.Button(root, text=app_name, command=lambda p=app_path: open_application(p)) button.grid(row=row, column=0, sticky="nsew") # Stretch buttons to fill the grid row += 1 # Display window root.mainloop()
How to use
- Copy the above code and save it as a Python file (e.g.,
launcher.py
). - Run it with Python, and a window will appear where you can launch each application with a single button click.
Customization examples
- If you want to add other applications, simply add their names and executable paths to the
app_buttons
list. - To change the window size, modify the numbers in
root.geometry()
. - To launch scripts or batch files, just add their paths in the same way.
How to enhance further?
Improve the appearance
This code uses very simple text buttons, but Tkinter offers many features. You can add background images, change fonts, and modify button colors to create a more visually appealing custom launcher.
Run scripts
Registering scripts or batch files is also very easy. You can automate frequent tasks or run specific processes with a single button click to significantly improve your daily workflow.
Add icons for convenience
By adding icons to buttons, you can make the launcher more intuitive and visually appealing. You can use Tkinter’s PhotoImage
to assign an image file to each button.
Conclusion
Using Python and Tkinter, you can create a very practical custom launcher with just a few lines of code. Register the applications and tools you use most frequently to improve your productivity. Plus, with customization, you can enhance both the appearance and functionality to suit your needs. Give it a try!
Commnts