<type>how-to</type>
<domain>install</domain>
<id>wxpython</id>
<title>Using Wing with wxPython</title>
<date>$Date$</date>
<product>pro+</product>
<summary>Learn how Wing Pro speeds up development and debugging of graphical user interfaces written with the wxPython cross-platform GUI development toolkit.</summary>

.. image:: /images/screenshots/wing7-screenshot-linen.png
  :alt: Wing Screen Shot
  :width: 574
  :height: 423
  :popup: 1

`Wing Pro <https://wingware.com>`__ is a Python IDE that can be used to develop, test, and
debug Python code written for the `wxPython <http://www.wxpython.org/>`__ cross-platform
GUI development toolkit. 

If you do not already have Wing Pro installed, `download it now <https://wingware.com/downloads/wingpro>`__.

This document describes how to configure Wing for wxPython. To get started using Wing as
your Python IDE, please refer to the tutorial in Wing's ``Help`` menu or read the
`Quickstart Guide <ref:howtos/quickstart>`__.

Introduction
------------

wxPython is a good choice for desktop application developers that want to use Python. It
is available for Windows, Linux, and macOS and provides native look and feel on each of
these platforms.

While Wing does not provide a GUI builder for wxPython, it does provide advanced editing,
debugging, testing, and code inspection capabilities for Python, and it can be used with
other available GUI builders, as described below.

Installation and Configuration
------------------------------

Take the following steps to set up and configure Wing for use with wxPython:

* Install wxPython as described on the `wxPython Downloads
  <https://www.wxpython.org/pages/downloads/>`__ page.  Be sure to install also the
  wxPython demo and samples.  
  
* Install `Wing <https://wingware.com/downloads>`__ if you don't already have it.

* Start Wing from the Start menu on Windows, the Finder or macOS, or by typing
  ``~~FULL_EXECUTABLE~~`` on the command line on Linux.
  
* Select `Show Python Environment <script:show_python_environment>`__ from the ``Source``
  menu. If the Python version reported there doesn't match the one you're using with
  wxPython, then select `Project Properties <script:view_project_properties>`__ from the
  ``Project`` menu and set `Python Executable
  <script:view_project_properties#highlighted_attrib="proj.pyexec">`__.

* Locate and open wxPython's ``demo.py`` into Wing and then select ``Add Current File``
  from the ``Project`` menu to add it to your project. If you can't find ``demo.py``
  but have other wxPython code that works, you can just use that. However, you'll
  need to adapt the instructions in the rest accordingly.
  
* Set ``demo.py`` as main entry point for debugging using the ``Set Current as Main Entry
  Point`` item in the ``Debug`` menu.

* Save your project to disk.  Use a name ending in ``.wpr``.

Test Driving the Debugger
-------------------------

Now you're ready to try out the debugger:

Start debugging with the ``Start / Continue`` item in the ``Debug`` menu. Uncheck the
``Show this dialog before each run`` checkbox at the bottom of the dialog that appears and
select ``OK``.

The demo application will start up. If its main window doesn't come to front, bring it to
front from your task bar or window manager. Try out the various demos from the tree on the
left of the wxPython demo app.

Next open ``ImageBrowser.py``, located in the same directory as ``demo.py``. Set a
breakpoint on the first line of ``runTest()`` by clicking on the dark grey left margin. Go
into the running demo app and select More Dialogs / ImageBrowser. Wing will stop on your
breakpoint.
  
From here, you can step through code or inspect the program state with ``Stack Data`` and
other tools. In Wing Pro, the ``Debug Console`` provides a command line that allows you to
interact with the current stack frame in your debug process. All the debugging tools are
available from the ``Tools`` menu.

See the `Wing Tutorial <ref:intro/tutorial>`__ and `Quick start <ref:howtos/quickstart>`__
for more information.

Using a GUI Builder
-------------------

Wing doesn't include a GUI builder for wxPython but it can be used with other tools, such
as wxGlade or wxFormBuilder. Wing will automatically reload files that are generated by
the GUI builder.

Related Documents
-----------------

Wing provides many other options and tools.  For more information:

* `wxPython website <https://www.wxpython.org/>`__

* `Quickstart Guide <ref:howtos/quickstart>`__ contains additional basic information
  about getting started with Wing.
  
* `Tutorial <ref:intro/tutorial>`__ provides a gentler introduction to Wing's features.

* `Wing Reference Manual <ref:manual>`__ documents Wing in detail.
