Wishing Code in Python (Wishing-code-Python) is a personal creative project — a lightweight script that greets the user based on the current system time and speaks the greeting using an offline Text-to-Speech engine (pyttsx3).
It’s perfect for practising conditional logic, time handling, and simple automation in Python.
wisher.py— Main Python script (detects time, prints & speaks greeting)README.md— Project documentation
- Reads current system date and time (Python
timemodule). - Chooses greeting by hour ranges:
- 00:00–05:59 → Early Morning
- 06:00–11:59 → Morning
- 12:00–15:59 → Afternoon
- 16:00–20:59 → Evening
- 21:00–23:59 → Night
- Speaks greetings using
pyttsx3(offline, cross-platform). - Prints a human-readable date and time stamp.
- Ensure you have Python 3.x installed on your system.
- Install dependency:
pip install pyttsx3 - Place
wisher.pyin your desired folder. - Run the script:
python wisher.py
You’ll see the printed date/time and hear the spoken greeting.
- If you hear no voice on Windows: check system audio settings and ensure an installed TTS voice is available.
- If
pyttsx3installation fails: trypython -m pip install --upgrade pipand reinstall. - Change timestamp format by editing the
time.strftimecalls inwisher.py. For example:
'%I:%M:%S %p'→ 12-hour format with AM/PM
'%H:%M:%S'→ 24-hour format - You can test different greetings by manually setting the
hourvariable.
- Save each greeting with timestamp to a log file.
- Play a custom sound along with the spoken greeting.
- Add command-line flags to choose greeting type.
- Convert it into a desktop app using
tkinteror bundle withpyinstaller.