The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Build a motivational quote wallpaper updater

Here’s a simple Motivational Quote Wallpaper Updater written in Python. This script fetches a motivational quote from an API and overlays it on a background image to set as your desktop wallpaper. It works on Windows, but can be adapted for macOS or Linux.

Features:

  • Fetches a random motivational quote

  • Creates an image with the quote overlaid

  • Sets it as your desktop wallpaper


⚙️ Requirements

Install dependencies first:

bash
pip install requests pillow

🧠 Python Script

python
import requests from PIL import Image, ImageDraw, ImageFont import ctypes import os import textwrap from datetime import datetime # Fetch quote def get_quote(): url = "https://api.quotable.io/random?tags=motivational|inspirational" response = requests.get(url) data = response.json() return f"{data['content']} — {data['author']}" # Create wallpaper with quote def create_wallpaper(quote, bg_path, output_path, width=1920, height=1080): image = Image.open(bg_path).resize((width, height)) draw = ImageDraw.Draw(image) # Load font (change path or use default) font_path = "arial.ttf" if not os.path.exists(font_path): font = ImageFont.load_default() else: font = ImageFont.truetype(font_path, 36) margin = 60 wrapped_text = textwrap.fill(quote, width=60) text_size = draw.textsize(wrapped_text, font=font) text_position = ((width - text_size[0]) / 2, (height - text_size[1]) / 2) # Add semi-transparent box box_margin = 20 box_position = [text_position[0] - box_margin, text_position[1] - box_margin, text_position[0] + text_size[0] + box_margin, text_position[1] + text_size[1] + box_margin] draw.rectangle(box_position, fill=(0, 0, 0, 150)) # Draw text draw.text(text_position, wrapped_text, font=font, fill="white") image.save(output_path) # Set wallpaper (Windows only) def set_wallpaper_windows(image_path): ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 3) # Main function def main(): quote = get_quote() bg_image = "background.jpg" # Provide a local image path output_image = f"motivational_wallpaper_{datetime.now().strftime('%Y%m%d%H%M%S')}.bmp" create_wallpaper(quote, bg_image, output_image) set_wallpaper_windows(os.path.abspath(output_image)) if __name__ == "__main__": main()

🔄 Tips

  • Automate it daily using Windows Task Scheduler or a cron job.

  • Replace background.jpg with your own image or download new ones dynamically.

  • Adapt set_wallpaper_windows() for macOS (osascript) or Linux (gsettings).

Would you like this extended into a GUI version or auto-run in the background as a service?

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About