Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
PyBoy documentation
PyBoy documentation
  • API reference
    • PyBoy
    • Memory view
    • Register file
    • Memory scanner
    • GameShark
    • Rumble
    • Super Game Boy
    • Screen
    • Sound
    • Sprite
    • Tile
    • Tile map
    • Constants
    • Utilities
    • Migrating from v1.x.x to v2.0.0
  • Plugins and game wrappers
    • Plugin base classes
    • Super Mario Bros. Deluxe wrapper
    • Super Mario Land wrapper
    • Tetris wrapper
    • Pandora’s Blocks wrapper
    • Kirby’s Dream Land wrapper
    • Pokemon generation 1 wrapper
    • Pokemon Pinball wrapper
    • 2048 wrapper
  • Development and installation
    • Install and build
      • Install PyBoy on macOS
      • Install PyBoy on Linux
      • Install PyBoy on Windows
    • Getting started
    • Development
    • Contributing
  • Examples
    • Kirby
    • Pokemon Gen 1
    • Pokemon Gen 1 Link Trade (Experimental)
    • Pandora's Blocks
    • Super Mario Bros. Deluxe
    • Super Mario Land
    • Tetris
    • Using PyBoy with Gymnasium
  • Test results
Back to top
View this page

Example: Pokemon Gen 1 Link Trade (Experimental)¶

The link-trade example runs two PyBoy instances connected through a shared-memory Game Boy serial cable. It prepares both games with a party, enters the Cable Club, and trades a Pokémon using the interrupt-based serial transport.

Running the example¶

Give the example a Pokémon Red or Blue ROM:

python extras/examples/gamewrapper_pokemon_link_trade.py "ROMs/POKEMON BLUE.gb"

Both emulator windows are shown by default. Use --headless to run without windows. The example also supports saving the three illustrated states:

python extras/examples/gamewrapper_pokemon_link_trade.py \
  "ROMs/POKEMON BLUE.gb" \
  --screenshots /tmp/pyboy-link-trade-screenshots

The script is available in the PyBoy repository.

Link-trade states¶

Cable Club

Trading menu

Pokémon transfer

Cable Club

Trading menu

Pokémon transfer

The two emulators must use compatible Pokémon Red/Blue ROMs. The shared serial buffer is process-safe and is only intended for two connected emulators.

Next
Example: Pandora’s Blocks
Previous
Example: Pokemon Gen 1
Copyright © 2026, Mads Ynddal
Made with Sphinx and @pradyunsg's Furo
PyBoy on GitHub 
On this page
  • Example: Pokemon Gen 1 Link Trade (Experimental)
    • Running the example
    • Link-trade states