Python Automation: Add a Simple Window to Your Script So Anyone Can Use It in One Click (tkinter)

Over the past few posts we have built a whole series of small Python automation programs: automatic backups, merging Excel files, pulling text out of images with OCR, scheduled tasks and more. Many owners tell me the same thing afterwards: "The scripts work great, but my colleagues take one look at that black Command window and back off — they are too scared to run them."

The problem isn't the script. It's that the interface looks intimidating. Wrap the script in a small window — an input box, a button, a result message — and colleagues treat it like any ordinary piece of software: one click and it's done. Today we'll use Python's built-in tkinter to give your automation a proper "suit" in a few dozen lines of code.

What is a GUI and why add one?

A GUI (Graphical User Interface) is what you already see every day: windows, buttons and text fields. With one, the user never has to type commands — a click is enough. For a business it matters in two ways. First, it lowers the barrier to entry; nobody has to learn command-line syntax. Second, it standardises the process, cutting human errors like typing the wrong path or skipping a step.

Step 1: No installation — tkinter ships with Python

Beginners assume building a graphical interface is complicated, but tkinter is part of Python's standard library. If Python is installed, tkinter is there — no pip install needed. Run python -c "import tkinter" in Command Prompt; if it doesn't error, you're ready to go.

Step 2: What will the little tool do?

  • Pick a folder — click "Choose Folder" and select a path in the dialog, instead of typing it by hand
  • Run with one click — click "Start Merging" and the program does the work
  • Instant feedback — a pop-up tells you how many files were merged

The demo merges every .txt file in a folder into one. Later you only need to swap out the middle section to reuse it for your own backup, reporting or OCR scripts.

Step 3: Write the script

Create a new file called tool.py (Notepad is fine) and paste in the code below:

import os import glob import tkinter as tk from tkinter import filedialog, messagebox def choose_folder(): folder = filedialog.askdirectory() if folder: path_var.set(folder) def run_tool(): folder = path_var.get() if not os.path.isdir(folder): messagebox.showwarning("Notice", "Please choose a valid folder first") return files = glob.glob(os.path.join(folder, "*.txt")) if not files: messagebox.showinfo("Notice", "No .txt files in this folder") return out_path = os.path.join(folder, "merged.txt") with open(out_path, "w", encoding="utf-8") as out_file: for f in files: with open(f, encoding="utf-8") as in_file: print(in_file.read(), file=out_file) status_var.set("Done! Merged %d files" % len(files)) messagebox.showinfo("Complete", "Output: %s" % out_path) root = tk.Tk() root.title("File Merge Tool") root.geometry("420x240") tk.Label(root, text="Step 1: choose the folder to process").pack(pady=(18, 4)) path_var = tk.StringVar() tk.Entry(root, textvariable=path_var, width=46).pack() tk.Button(root, text="Choose Folder", command=choose_folder).pack(pady=6) tk.Button(root, text="Start Merging", command=run_tool, bg="#E86E18", fg="white", font=("Segoe UI", 12, "bold")).pack(pady=8) status_var = tk.StringVar(value="Ready") tk.Label(root, textvariable=status_var, fg="#444444").pack(pady=6) root.mainloop()

Line by line

  • import tkinter as tk — loads Python's built-in graphical interface toolkit.
  • filedialog / messagebox — two ready-made dialogs: one to pick a file or folder, one to show a message.
  • choose_folder() — runs when you click "Choose Folder"; it opens the picker and writes the chosen path into the input box.
  • run_tool() — the core: check the path and whether files exist, then use glob to find every .txt and merge them into one.
  • path_var / status_var — the input box and status label are bound to these "live" text variables, so the screen updates the moment a value changes.
  • command=run_tool — clicking the button calls run_tool(). This single line is what makes it "one-click".
  • root.mainloop() — keeps the window open; leave it out and the window flashes and vanishes.

Step 4: Run it, then package it

Type python tool.py in Command Prompt and the window appears — try "Choose Folder" then "Start Merging". To take it further, use pyinstaller to package it into a single .exe file. No Python installation required, just double-click, and you can even set a custom icon — so colleagues have no idea it was "written" rather than bought.

Summary

Python Tutorial: a good automation script doesn't just have to run correctly — it has to be something your colleagues dare to use. Wrapping it in a small tkinter window of a few dozen lines turns "the command line" into a one-click company tool, cutting the barrier and the odds of mistakes along with it. Next time you finish a script, spend ten extra minutes adding an interface — you'll find colleagues go from "won't touch it" to "use it every day", and only then does it truly save time.