Running wxPython Properly in Spyder 6 (2024–2026)

Spyder uses Qt — wxPython uses wxWidgets. Running both in the same process usually breaks (no window, freeze, crash). Here are the working workarounds.

  1. Run in dedicated / external Python process — most reliable
    • Open script in Spyder Editor
    • Press F6 or Run → Configure
    • Select:
      • Execute in a new dedicated Python interpreter (best choice)
      • or Execute in an external system terminal
    • Uncheck "Interact with console after execution" (optional)
    • Then just press F5 — Spyder remembers this per file
  2. Separate console just for GUI code
    • Consoles → New console (or click + icon)
    • Choose "new dedicated Python interpreter"
    • Paste code or %run your_script.py in that console

import wx

app = wx.App()
frame = wx.Frame(None, title="wxPython Test — Spyder 6", size=(400, 300))
panel = wx.Panel(frame)
txt = wx.StaticText(panel, label="If you see this window → it works!", pos=(20, 20))
frame.Show()
app.MainLoop()

Run with one of the two methods above.

Make sure wxPython is in the environment Spyder uses:

pip
pip install wxPython
conda
conda install -c conda-forge wxpython

Python versions that usually work well (2025–2026):

  • 3.9 – 3.12

Using plain F5 in the default IPython console:

  • No window appears
  • Freezes / hangs
  • Event loop errors
  • Crashes on close (especially macOS)

Reason: Qt + wxWidgets fighting over the main loop in the same process.

Method Reliability Window appears? Debugging possible? Recommended?
F5 in default console Low Usually no Yes Avoid
F6 → Dedicated interpreter High Yes Limited Yes
F6 → External terminal High Yes No Yes (fallback)
Separate dedicated console Medium-High Yes Yes Good
Quality, Reliability & Service
Thank You For Visiting
Brooks Computing Systems - Jacksonville
Visit https://bcs.archman.us