Just a basic practice of Python with Library Tkinter.
This is a clean, functional script for a basic Wallpaper Viewer using Python's Tkinter library. Itβs a great example of how to handle image manipulation and GUI state.Here is a structured README.md designed to make your project look professional and easy to navigate.
πΌοΈ Wallpaper ViewerA lightweight, Python-based GUI application built with Tkinter and Pillow that allows users to cycle through a collection of images stored in a local directory.
π FeaturesDynamic Loading: Automatically reads all image files from a specific folder.
Auto-Resizing: Images are dynamically resized to fit a standard portrait orientation (
π οΈ PrerequisitesBefore running the script, ensure you have Python installed and the Pillow library for image processing.Bashpip install Pillow
π Project StructureTo run this script successfully, your directory should look like this:Plaintext. βββ main.py # Your python script βββ wallpapers/ # Folder containing your .jpg or .png files βββ image1.jpg βββ image2.png βββ ...
π» How It WorksThe application follows a simple but effective logic flow:1. Image ProcessingThe script uses os.listdir to grab filenames and the Pillow (PIL) library to open and resize them so they fit the GUI window perfectly.2. State ManagementA counter variable tracks the current image index. The rotate_img function updates the display using the formula:counter % len(img_array)This ensures that even if you click "Next" a thousand times, the index always wraps back to the start of your image list.
π UsagePlace all your desired images in a folder named wallpapers.Run the script:Bashpython main.py Click the Next button to cycle through your wallpapers!