Running Idle on Windows 7

P

Phil Rist

I have installed ActiveState Python 32bit on my computer. There
are potentially five different ways that Idle can be run. Actually six
if you include activating a command window and typing in the command.
We will not do that here.

The first way is to use the shortcut put into the start menu by the
ActiveState installation program. Left click on the start menu icon
followed by hovering over the 'All Programs' button will bring up the
menu. At this point find and click the ActiveState ActivePython entry.
This will bring up the Python sub-menu on which Idle can be found and
clicked to start Idle. If this is not previously you could create a shortcut as
described below and move it to the start button. I do not know how to do that
on Windows 7.

The other methods may require some effort on your part. Each extension
has a file type. Each file type has a context menu which can be accessed
by right clicking an appropriate Windows Explorer entry or desktop icon.
The contents of the context menu is maintained in the registry. The Regedit
utility can be used to modify the menu.

The following text typed into a file with a .reg extension can be used to
create part of a context menu for files with either a .py or .pyw extension.
Once the file is created it can be run by double clicking the file's
entry in Windows Explorer. The file type I selected is pyfile. If you select
a file type that already exists it will be overwritten. If these extensions
have already been given a file type that file type should be used. If there is
already an Open command and you do not want to replace it change the Open names
here to something that is not already used. Note the wrapping of the last
line.


REGEDIT4

[HKEY_CLASSES_ROOT\.py]
@="pyfile"

[HKEY_CLASSES_ROOT\.pyw]
@="pyfile"

[HKEY_CLASSES_ROOT\pyfile]
@="Python source"

[HKEY_CLASSES_ROOT\pyfile\Shell]
@="Open"

[HKEY_CLASSES_ROOT\pyfile\Shell\Open]
@="Open"
"EditFlags"=hex:01,00,00,00
[HKEY_CLASSES_ROOT\pyfile\Shell\Open\Command]
@="c:\\sys\\Language\\python\\pythonw.exe
C:\\Sys\\Language\\Python\\Lib\\idlelib\\idle.pyw \"%1\" "

The first two group of lines simply assign the pyfile file type to the two
extensions. The third group sets the file type description displayed by
Windows Explorer to 'Python Source'. The fourth group makes Open the default
command. The command that will be executed when a file is doubled clicked.
The last group defines the text for the command. This is basically the same as
any command entered in a command window except instead of a file name %1 is
entered. This will be replaced by the name of the selected python file. Also
any
'\' or '"' which appear in the command must be preceeded by a '\'. The command
given here will run Idle. The file paths will need to be changed to what is
appropriate on your computer.

I noticed that I had a file type Python.File. This file type had two commands
one to run the program, 'Open' and one to Edit with Pythonwin,
'Edit with Pythonwin'. This was setup by the ActiveState installation program.
These can be recovered with a .reg file with the following contents.

REGEDIT4

[HKEY_CLASSES_ROOT\.py]
@="Python.File"

[HKEY_CLASSES_ROOT\.pyw]
@="Python.File"


There is also a context menu for directories. One menu for all directories.
An entry for Idle can be created with the following code. This also is
entered into a .reg file. The same rules apply. Here %1 will be replaced
by the directory path. Like the Start Menu method you do not have access
to a file path. Note the wrapping of the last line.

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\Shell\Idle]
@="Idle"
"EditFlags"=hex:01,00,00,00
[HKEY_CLASSES_ROOT\Directory\Shell\Idle\Command]
@="c:\\sys\\Language\\python\\pythonw.exe
C:\\Sys\\Language\\Python\\Lib\\idlelib\\idle.pyw "


The fourth way is to create a shortcut to Idle. This is basically the same
as the Start Menu method except the shortcut can be put on the desktop where
it will appear as an icon or in any directory where it can be accessed from
Windows Explorer. My technique here was to create a directory called 'Python'.
Within that directory I created three directories 'New', 'Explore' and
'Projects'
to contain my Python programs. The 'Python' directory contains infrastructure
files such as the .reg files.

I created a fourth sub-menu called 'Python Shortcuts'. I added several
shortcuts which I thought would be useful, including a shortcut to Idle.
Windows allows me to create a toolbar on the quick launch bar. This toolbar
contains a list of the contents of a selected directory. In my case the 'Python
Shortcuts' directory. I can run Idle by clicking on the toolbar and then the
entry for Idle.

To create the shortcut find the Python interpreter pythonw.exe. Right click it
and select 'Create shortcut'. The shortcut will appear in the same directory as
pythonw.exe. Drag it to the directory you want it in. Right click it and
select 'Properties'. In the middle of the dialog is a text box labeled
'Target'. This field contains the command which will be executed. Add the path
to Idle.pyw to the end of the command. Click the OK button. You can also
create a shortcut to the supplied .bat file. This will work without any further
editing.

The last method is to use a program which accepts command lines from some
source. I have a buttonbar program which uses an initialization file which
defines each command for each button.

As a word of warning, .reg files are not the easiest things to work with.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top