Time to build something practical in Python that will run on my Windows desktop, with a GUI.
Lets use CoPilot, we are going to ask it to build a local network scanner, in python, with a gui, use current subnet but allow changes, returns ip address and mac’s.
Lets also switch it up, lets have AI create the prompt to match our desired results.
You can keep reiterating the request multiple times, actually have one AI Chatbot write it the ifrst time, plug it into another to imporve it, in other words just keep cycling it through, making it more perfect each time.
My original request of “Make a python program, run on windows desktop, have a gui interface, that scans the local network, gets ip addresses and mac addresses, use current subnet, allow changes.”
Copilot finally came up with this:
Here’s a tightened, clearer, and more “reusable” version of your prompt:
Prompt:
Create a complete, ready-to-run Python program (single
.pyfile) that runs on Windows using IDLE.Overall goal:
A local network scanner with a tkinter GUI (no CLI) that scans a subnet for active devices and shows results in a table.
1. Environment and constraints
- Platform: Windows
- Run method: Directly from IDLE (no special setup)
- Libraries: Only Python standard library (no external dependencies)
- Interface: GUI using
tkinterandttk(no console interaction)
2. Core functionality
The program must:
- Detect local network info
- Automatically detect the local IPv4 address.
- Automatically generate a default subnet in CIDR form, e.g.
192.168.1.0/24.- Show this subnet in an editable input field so the user can change it before scanning.
- Subnet handling
- Validate the subnet input (basic sanity checks: format, range, etc.).
- If the subnet is very large (e.g. more than 1024 addresses—exact threshold is up to you), show a warning dialog asking the user to confirm before scanning.
- Network scanning
- Scan the specified subnet for active devices.
- For each active device, obtain and display:
- IP address
- MAC address (best-effort; if not available, handle gracefully)
- Use multithreading so the GUI remains responsive during scanning.
- Show progress, e.g.
"Scanning X/Y addresses".
3. Windows-specific behavior
- Do not open or flash any
cmdor console windows during scanning.- If you use
subprocess(e.g. forpingorarp), configure it so that:
- No console window appears (e.g. using
CREATE_NO_WINDOWor equivalent).- The user only interacts with the tkinter GUI.
4. GUI requirements
Use
tkinterandttkto build a clean, beginner-friendly UI that includes:
- Input and controls
- A text entry for the subnet (pre-filled with the detected default subnet).
- A Scan button to start scanning.
- Before starting a new scan:
- Clear any previous results from the table.
- Reset progress/status indicators.
- Status and progress
- A status label that shows states such as:
"Ready""Scanning...""Complete"- A progress indicator (e.g.
"Scanning X/Y addresses"), updated as the scan proceeds.- Results table
- Use a
ttk.Treeviewto display results in a table with at least:
- IP Address
- MAC Address
- Optional (include if feasible):
- Allow sorting by IP address when clicking the column header or by default after scan completion.
- Thread-safe UI updates
- Ensure that all UI updates are done in a thread-safe way:
- For example, use a
queueorafter()callbacks to update the GUI from worker threads.
5. Code quality and structure
- Organize the code into clear functions and/or classes (e.g. a main
Appclass for the GUI).- Write beginner-friendly, well-commented code:
- Explain key sections (GUI setup, threading, scanning logic, subprocess usage, etc.).
- Handle runtime errors gracefully:
- Use
try/exceptwhere appropriate.- Show user-friendly error messages in the GUI (e.g. via message boxes) instead of crashing.
6. Error handling and edge cases
- Subnet validation:
- Detect invalid formats and show a clear error message (e.g. using
messagebox).- Large subnet warning:
- If the subnet is above a reasonable size threshold, show a confirmation dialog before starting.
- Runtime issues:
- If a scan fails or a subprocess call errors, handle it without crashing and update the status label accordingly.
7. Deliverables
- Provide full, complete code in a single file—no placeholders, no omitted parts.
- At the end, include a short section of plain-text instructions titled “How to run in IDLE”, explaining:
- How to save the file (e.g.
network_scanner.py).- How to open it in IDLE.
- How to run it (e.g.
Run → Run Moduleor pressingF5).Do not provide partial code. The output must be a complete, ready-to-run solution that satisfies all requirements above.
I created a new chat window and gave it this prompt.

I ran the code CoPilot came up with and it executed just fine, producing a local network scanner.