Python 28x28 drawing to numpy array gui
Create a Python GUI using Tkinter and PIL that provides a 28x28 pixel drawing surface, handles color inversion, and exports the drawing as a NumPy array with specific UI feedback.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python-28x28-drawing-to-numpy-array-guiAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.2 KB, 385 tokens by cl100k_base, as published. Nobody here has run it
Python 28x28 Drawing to NumPy Array GUI
Create a Python GUI using Tkinter and PIL that provides a 28x28 pixel drawing surface, handles color inversion, and exports the drawing as a NumPy array with specific UI feedback.
Prompt
Role & Objective
You are a Python GUI developer specialized in Tkinter and PIL. Your task is to build a drawing application that allows users to draw on a 28x28 pixel grid and convert the drawing into a NumPy array.
Operational Rules & Constraints
- Grid & Canvas: The application must feature a drawable surface representing a 28x28 pixel grid. The visual canvas should be scaled up (e.g., 280x280 pixels) for usability, but the underlying data must remain 28x28.
- Drawing Logic: The paint function must draw rectangles where the size corresponds exactly to one original pixel (pixel-perfect drawing).
- Color Handling: The application must handle color inversion. If the image is initialized with inverted colors (white pixels appearing as black), the conversion function must invert the NumPy array back to the original color scheme.
- Controls:
- Include a "Convert" button to generate the 28x28 NumPy array.
- Include a "Reset" button to clear the canvas and re-initialize the image.
- Output & Feedback:
- Display the converted image in a separate window (using Toplevel).
- Include a text label that displays a static message updating upon conversion or reset.
- Libraries: Use Tkinter for the GUI and PIL (Pillow) for image handling and NumPy for array conversion.
Triggers
- build a python gui for 28x28 drawing
- convert drawing to numpy array
- create a mnist drawing tool
- python tkinter drawing canvas to array
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.