Create a Python Debt Reminder Tool with Scheduled Pop‑ups and One‑Click Executable
Learn how to build a simple Python utility that periodically reminds a friend to repay a loan, using pip‑installed packages like APScheduler and pywin32 for scheduling and pop‑up messages, then package the script into a standalone executable with PyInstaller, complete with code snippets and screenshots.
Introduction
This tutorial shows how to create a small Python tool that reminds a borrower to repay a loan. The script displays a pop‑up message at regular intervals, helping maintain good relationships while ensuring timely repayment.
Requirements
The tool relies on the following Python packages, which are included with Python 2.7.9+ or Python 3.4+:
pip – the standard package manager for installing Python libraries.
APScheduler – provides scheduling capabilities.
pywin32 – enables Windows API calls for displaying message boxes.
Install the necessary packages with:
pip install apscheduler pywin32Code
The core script imports the required modules, defines a function to show the reminder, and sets up a scheduler that triggers the function every minute.
import win32api, win32con, time
from apscheduler.schedulers.blocking import BlockingScheduler
def DrunkWater():
win32api.MessageBox(0, "你的欠款已逾期,为了不影响朋友间的感情,请尽快结清!", "还钱小助手", win32con.MB_OK)
scheduler = BlockingScheduler()
scheduler.add_job(DrunkWater, 'interval', minutes=1)
if __name__ == '__main__':
while True:
scheduler.start()
time.sleep(1)Packaging
To distribute the tool as a single executable, use PyInstaller . Install it via: pip install pyinstaller Then run the following command in the directory containing the script: pyinstaller -F -w demo.py The -F flag creates a one‑file bundle, and -w suppresses the console window.
Result
After packaging, the dist folder contains the executable that behaves exactly like the original demo.py script, showing the reminder pop‑up at the configured interval.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
