GUI app that checks out Pokemon info
Find a file
Luca Francesca e1d5a928d0
Some cleaning up
Added a better README.md and removed the dockerfile.
A Makefile was added for building on linux.

Signed-off-by: Luca Francesca <luca@lucafrancesca.me>
2026-01-10 11:17:34 +01:00
.gitignore First commit 2026-01-10 10:21:57 +01:00
FyneApp.toml Some cleaning up 2026-01-10 11:17:34 +01:00
go.mod First commit 2026-01-10 10:21:57 +01:00
go.sum Update dockerfile to go 1.25 2026-01-10 10:25:13 +01:00
Icon.png First commit 2026-01-10 10:21:57 +01:00
list.go Removed unused list 2026-01-10 11:10:08 +01:00
main.go Pokemon by gen 2026-01-10 11:08:57 +01:00
Makefile Some cleaning up 2026-01-10 11:17:34 +01:00
pkmn.go First commit 2026-01-10 10:21:57 +01:00
README.md Some cleaning up 2026-01-10 11:17:34 +01:00
windows.go Pokemon by gen 2026-01-10 11:08:57 +01:00

pkmnviewer

PKMViewer is a small desktop GUI application that looks up Pokémon information using the public PokéAPI and displays sprites, abilities, types, and base stats. The UI is built with the Fyne GUI toolkit.

This README contains build and run instructions, prerequisites, a short file overview, and basic troubleshooting tips.


Prerequisites

  • Go (recommended >= 1.24). The module declares go 1.24.0 and the project was developed with a Go toolchain referenced as go1.25.5. Using a recent Go release (1.24 or newer) is recommended.
  • Network access (the app queries the public PokéAPI at runtime).
  • No API keys are required.

Platform-specific notes:

  • On macOS the app should run out of the box with Go installed.
  • On Linux, Fyne may require additional system libraries (OpenGL / X11 / Wayland) depending on your distribution. If you see errors related to graphics or windowing, consult the Fyne docs for platform-specific requirements.

Dependencies (from go.mod):

  • fyne.io/fyne/v2 — GUI toolkit
  • github.com/mtslzr/pokeapi-go — PokéAPI client

Build & Run

From the project root (the directory containing go.mod):

  • Run directly (for development):

    • go run .
  • Build a local executable:

    • go build -o pkmnviewer
  • Run the built executable:

    • ./pkmnviewer (on macOS / Linux)
    • pkmnviewer.exe (on Windows)
  • Ensure modules are fetched / tidy if needed:

    • go mod tidy
    • go mod download

Cross-compilation examples:

  • Linux amd64:
    • GOOS=linux GOARCH=amd64 go build -o pkmnviewer-linux-amd64
  • macOS arm64:
    • GOOS=darwin GOARCH=arm64 go build -o pkmnviewer-darwin-arm64
  • Windows amd64:
    • GOOS=windows GOARCH=amd64 go build -o pkmnviewer.exe

Note: Cross-compiling GUI applications can be more complicated if system-specific libraries or cgo are required by your GUI backend. If you run into issues, build on the target platform or consult Fyne cross-compilation guidance.

Optional tooling:

  • The fyne CLI can help with packaging native bundles (optional). Install it with:
    • go install fyne.io/fyne/v2/cmd/fyne@latest
    • See Fyne docs for packaging for macOS, Windows, Linux.

How the app works (brief)

  • The main window shows:
    • A generation selector (e.g. "1", "2", ...).
    • After selecting a generation, a second selector populates with Pokémon species names from that generation.
    • Selecting a Pokémon loads its details from the PokéAPI and opens a secondary window with:
      • Normal and shiny sprites (front/back).
      • Abilities and whether they are hidden.
      • Types.
      • Base stats displayed with progress bars and total.

No persistent storage is used; every selection queries the PokéAPI at runtime.


Project layout / important files

  • go.mod — module and dependency declarations.
  • main.go — application entrypoint, creates the main Fyne app and window.
  • windows.go — UI glue: dropdowns, handlers for generation and Pokémon selection, fetching data via pokeapi-go, creating the secondary window and layout.
  • pkmn.go — UI helper functions: sprite creation, stats / type / ability containers and other view helpers.
  • list.go — simple list of available generation strings (genList).
  • README.md — this file.

Troubleshooting

  • Unknown imports or build failures:

    • Run go mod tidy and then go build or go run .
    • Run go env to check GOPATH/GOMOD settings if modules are not resolving.
  • Fyne / GUI issues on Linux:

    • Ensure required system libraries for windowing / OpenGL are installed for your distro.
    • Consult the Fyne documentation: https://fyne.io/
  • Sprites not loading or empty images:

    • The app loads sprite URLs from the PokéAPI. If the API is unreachable or a specific sprite URL is empty, images may not render.
    • Make sure you have network connectivity and the PokéAPI is reachable.
  • App shows simple errors via dialogs or notifications — check those messages for actionable hints.


Extending the app

  • Add caching to reduce API requests (e.g., in-memory or file-based cache).
  • Add pagination or search for Pokémon by name/ID.
  • Add localization (Fyne supports text rendering and multiple languages).
  • Add packaging scripts using the fyne CLI to produce native installers.

Notes

  • This project uses the public PokéAPI and does not bundle or host any API keys.
  • The window title prints the CPU architecture (the code uses runtime.GOARCH).

If you need a packaged installer for a specific platform or help debugging a build error, tell me which OS and the exact error output and I can suggest next steps.