Screenshots and readme.txt for codeEditor

The codeEditor sample in PythonCard is focused on being a simple to use Python source code editor. It is not intended to be a generic editor or replace vi(m), Emacs, etc. If you are already happy with your existing editing environment for Python source code, there is no particular reason you have to switch. codeEditor and the resourceEditor and shell will be more tightly integrated as the project progresses so that the user has a simple Integrated Development Environment (IDE) for building desktop applications without needing to use an external program for editing.

It borrows ideas and code from IDLE as well as Mark Hammond's Pythonwin, PyCrust (the PythonCard shell) and Robin Dunn's The core editor component uses the wxPython wxStyledTextCtrl (wxSTC) which in turn uses Neil Hodgson's Scintilla. Isn't open source fun? In 15 minutes you can have a pretty decent editor by standing on the shoulders of others.

Design Questions and Goals

To Do



In addition to the wxPython wxStyledTextCtrl (wxSTC) page, you should check out the Scintilla Documentation. There is a good set of API documentation at

We should be able to adapt the following documents for codeEditor. They are also a good source of features that should be supported.

Here's some IDLE documentation, written by Daryl Harms.

Danny Yoo wrote an extremely gentle introduction to IDLE: One Day of IDLE Toying.

Pythonwin docs, including a section on supported command-line arguments

codeEditor source

codeEditor in cvs

Associating Python files with codeEditor on Windows

These instructions are for Windows 2000, and Windows XP. They may be slightly different on other versions of Windows.

  1. Open the Explorer and choose "Folder Options..." under the "Tools" menu
  2. Click on the "File Types" tab
  3. Scroll down in the "Registered file types" list and select extension "PY Python File"
  4. Click on the "Advanced" button 4a. You should be looking at an "Edit File Type" dialog with a list of Actions such as Edit and Open. Open is probably in bold since it is the default action usually associated with .py files.
  5. Click on the "New..." button 5a. You should be looking at a "New Action" dialog
  6. In the "Action:" field type in a label such as "Edit with PythonCard". This is the label that will show up in the context menu when you right-click on a .py file in the Explorer

  7. in the "Application used to perform action:" field you need to specify the path to the Python executable as well as the location of the file. On a Python 2.2.1 installation using the default installer this will look like:

    C:\Python22\pythonw.exe C:\Python22\PythonCardPrototype\samples\codeEditor\ "%1" Substitute your own paths for the ones above and put quotes (") around the paths with spaces in them, if any. If you want a console when runs, then use python.exe instead of pythonw.exe

  8. Click "OK"
  9. You should now have an "Edit with PythonCard" item in your "Edit File Type" dialog

  10. The item in bold is the default action; Open will be the default if nothing is showing up in bold. Whether you want to "Edit with PythonCard" or "Open" (run) a script when you double-click a file in the Explorer is of course a personal preference. If you want "Edit with PythonCard" as the default action, then select "Edit with PythonCard" in the list, and click the "Set Default" button.

  11. Click "OK"
  12. Click "Close" in the "Folder Options" dialog
  13. Open a directory in the explorer that contains a .py file, then right-click on the file and choose "Edit with PythonCard" and the file should be opened with

  14. If it doesn't work, double-check the steps above
  15. Repeat the process for .pyw files, using the same name and path.

Windows 7

In their infinite wisdom, under Windows 7, Microsoft removed the ability for end-users to perform the procedure as described above. See: []. You can either use the registry editor regedit to perform the necessary key additions, or (much easier) download a trial copy of a very useful program "Creative Element Power Tools" from [] and use the "File Type Doctor" in that package to set the file type (similar operating procedure as described above for Windows 2000).


Initials indicate comments by particular individuals. Please add yourself as you make changes to this wiki page.


PythonCardEditor (last edited 2011-05-15 07:14:21 by 99-9-39-161)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.