How do you configure IDLE on a Mac, seeing as there's no ConfigureOption...

M

Mensanator

....because there's no [Options] menu on the shell window?

Or at least give me a clue to how to use Courier New font?

For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.
 
A

Alf P. Steinbach

* Mensanator:
...because there's no [Options] menu on the shell window?

Or at least give me a clue to how to use Courier New font?

For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.

Why not just use the Python interpreter, a reasonable programmer's editor and,
if you need it, some debugger.

The source code level debugging in IDLE is nothing to write home about.

In Windows XP it is just silly: it marks the current line by ordinary text
selection, which (depending on your config, but I think this is default) is
invisible when you're looking at the debugger window for single stepping. You
can see it by switching back to the source code window but that's annoying, not
very practical. Invisible highlighting of the current line, he he...


Cheers & hth.,

- Alf
 
B

Benjamin Kaplan

...because there's no [Options] menu on the shell window?

Or at least give me a clue to how to use Courier New font?

For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.

Mac Applications don't have "options" menus. They have a "preferences"
pane which is the second item in the application menu (the one that
takes the name of the active program) and has a keyboard shortcut of
Cmd-,

Apple's user-interface guidelines are pretty specific, so you'll find
that this works for all native OS X (i.e. not X11) applications.
 
S

Steve Holden

Alf said:
* Mensanator:
...because there's no [Options] menu on the shell window?

Or at least give me a clue to how to use Courier New font?

For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.

Yeah, that was a smart move, wasn't it?
Why not just use the Python interpreter, a reasonable programmer's
editor and, if you need it, some debugger.

The source code level debugging in IDLE is nothing to write home about.
I quite agree.
In Windows XP it is just silly: it marks the current line by ordinary
text selection, which (depending on your config, but I think this is
default) is invisible when you're looking at the debugger window for
single stepping. You can see it by switching back to the source code
window but that's annoying, not very practical. Invisible highlighting
of the current line, he he...
I remember being extremely surprised to read that a Python developer I
greatly admire uses IDLE as his main development interface. Frankly I
have always found IDLE extremely non-intuitive, and I am constantly
frustrated at having to explain about its shortcomings and oddities to
newcomers in my "Introduction to Python" classes.

Who actually maintains IDLE nowadays?

regards
Steve
 
N

Ned Deily

Benjamin Kaplan said:
...because there's no [Options] menu on the shell window?

Or at least give me a clue to how to use Courier New font?

For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.
Mac Applications don't have "options" menus. They have a "preferences"
pane which is the second item in the application menu (the one that
takes the name of the active program) and has a keyboard shortcut of
Cmd-,

Apple's user-interface guidelines are pretty specific, so you'll find
that this works for all native OS X (i.e. not X11) applications.

But be aware that IDLE on OS X has had various problems with missing
and/or duplicate menu items. IIRC, the current python.org OS X IDLEs
(2.6.4 and 3.1.1) should be OK and you can modify the font via the
Preferences menu (and currently changed preferences apply to all
versions of IDLE). Note also that there are two different ways to
launch the OS X IDLE. python.org installers put a double-clickable
IDLE.app in /Applications/Python n.x. There is also a command-line
"idlen.n" in /Library/Frameworks/Python.framework/Versions/n.n/bin
which, optionally, has a symlink from /usr/local/bin.
 
M

Mensanator

...because there's no [Options] menu on the shell window?
Or at least give me a clue to how to use Courier New font?
For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.

Mac Applications don't have "options" menus. They have a "preferences"
pane which is the second item in the application menu

Sometimes it's the second item, sometimes it's not
(the one that
takes the name of the active program) and has a keyboard shortcut of
Cmd-,

Apple's user-interface guidelines are pretty specific, so you'll find
that this works for all native OS X (i.e. not X11) applications.

Right, it doesn't apply to IDLE which uses X11 (there is a preferences
window,
but it doesn't have any font control, unlike stuff like Safari).

I assume there must be a configuration file. Any idea what that file
is called?
 
M

Mensanator

 Benjamin Kaplan said:
...because there's no [Options] menu on the shell window?
Or at least give me a clue to how to use Courier New font?
For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.
Mac Applications don't have "options" menus. They have a "preferences"
pane which is the second item in the application menu (the one that
takes the name of the active program) and has a keyboard shortcut of
Cmd-,
Apple's user-interface guidelines are pretty specific, so you'll find
that this works for all native OS X (i.e. not X11) applications.

But be aware that IDLE on OS X has had various problems with missing
and/or duplicate menu items.  IIRC, the current python.org OS X IDLEs
(2.6.4 and 3.1.1) should be OK and you can modify the font via the
Preferences menu

No, I already checked. Both system preferences and X11 preferences.
(and currently changed preferences apply to all
versions of IDLE).  Note also that there are two different ways to
launch the OS X IDLE.  python.org installers put a double-clickable
IDLE.app in /Applications/Python n.x.

Yeah, I've still got that one installed, but it has the broken
distutils
from python.org.

 There is also a command-line
"idlen.n" in /Library/Frameworks/Python.framework/Versions/n.n/bin
which, optionally, has a symlink from /usr/local/bin.

AARRGGHH!!! I'm pulling my hair out!

I haven't been using the IDLE from the broken python.org disk image.

I assume I've been using the IDLE from macports. From the command
prompt I've
been typing "idle". This launches a "shell" window which appears to
have an X11
parent application for which there are no "preferences" applicable to
fonts.

However, if I use the quick launcher from the python.org, I get a
"shell" whose
parent is named "IDLE"! And that one has a completely different
preferences,
one similar the the Windows Configure which allows me to set the font!

Now, if I close this shell and start IDLE from the command line again,
I still
get a "shell" with an X11 parent, but, lo and behold, the font has
changed to
what I had previously set with the IDLE parent.

Course, I can't import gmpy, cause the python.org version can't
compile it, so I
still have to use the macports install of 3.1, but that's ok, once I
use
the IDLE application to set the preferences, I can switch back to the
X11 version and the preferences will follow.

Wow!

That was fun. Thanks for the help everyone. Don't ask me to explain
what I just
did, sometimes you just have to let art flow over you.
 
M

Mensanator

...because there's no [Options] menu on the shell window?
Or at least give me a clue to how to use Courier New font?
For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.
Mac Applications don't have "options" menus. They have a "preferences"
pane which is the second item in the application menu

Sometimes it's the second item, sometimes it's not
(the one that
takes the name of the active program) and has a keyboard shortcut of
Cmd-,
Apple's user-interface guidelines are pretty specific, so you'll find
that this works for all native OS X (i.e. not X11) applications.

Right, it doesn't apply to IDLE which uses X11

Depending on how you launch it.

If I type "idle" at a command prompt, I get a shell window whose
parent
is X11. Here you will get X11 preferences which can't be used to
change fonts.

If I click the IDLE icon, then I get a shell whose parent is IDLE, not
X11 and
here you'll find a preferences window similar to the OPTIONS/Configure
in Windows.
(there is a preferences
window,
but it doesn't have any font control, unlike stuff like Safari).

I assume there must be a configuration file. Any idea what that file
is called?

I still don't know but apparently as long as I use the IDLE
application
instead of X11, I can set the font.

Thanks for your time.
 
M

Mensanator

* Mensanator:
...because there's no [Options] menu on the shell window?
Or at least give me a clue to how to use Courier New font?
For some inscrutable reason, depite the plethora of formatting tools,
someone decided that proportional spaced fonts ought to be the
default for IDLE.

Why not just use the Python interpreter, a reasonable programmer's editor and,
if you need it, some debugger.

I think I've solved my problem.

I'll just say here that at least IDLE is cross-platform AND is part of
the
"batteries included". I'll be using it on both my new Mac and my
desktop
PCs running Windows.
The source code level debugging in IDLE is nothing to write home about.

I've got 20 years worth of programs and web pages written with
Notepad,
so don't let me hear any dissing of IDLE, ok? :)
 
N

Ned Deily

I assume I've been using the IDLE from macports. From the command
prompt I've
been typing "idle". This launches a "shell" window which appears to
have an X11
parent application for which there are no "preferences" applicable to
fonts.

However, if I use the quick launcher from the python.org, I get a
"shell" whose
parent is named "IDLE"! And that one has a completely different
preferences,
one similar the the Windows Configure which allows me to set the font!

Now, if I close this shell and start IDLE from the command line again,
I still
get a "shell" with an X11 parent, but, lo and behold, the font has
changed to
what I had previously set with the IDLE parent.

Course, I can't import gmpy, cause the python.org version can't
compile it, so I
still have to use the macports install of 3.1, but that's ok, once I
use
the IDLE application to set the preferences, I can switch back to the
X11 version and the preferences will follow.

The prefs follow because all versions of IDLE use the same (unversioned)
directory for configuration files, ~/.idlerc/. In particular, the
configuration file ~/.idlerc/config-main.cfg contains, among other
things, any changes to the default font. So, if you're successful at
changing it in one version of IDLE, it will likely affect all versions
you have. Note the file is a simple ini format:

[EditorWindow]
font = monaco

so you can edit it by hand.

BTW, the python.org IDLEs and the Apple-supplied IDLEs use the
system-supplied Aqua (aka Quartz) Tk not the X11 one that MacPorts
builds by default. The MacPorts Tk port does have a "quartz" variant
but that doesn't yet work in 64-bit mode.
 
M

Mensanator

 Mensanator said:
I assume I've been using the IDLE from macports. From the command
prompt I've
been typing "idle". This launches a "shell" window which appears to
have an X11
parent application for which there are no "preferences" applicable to
fonts.
However, if I use the quick launcher from the python.org, I get a
"shell" whose
parent is named "IDLE"! And that one has a completely different
preferences,
one similar the the Windows Configure which allows me to set the font!
Now, if I close this shell and start IDLE from the command line again,
I still
get a "shell" with an X11 parent, but, lo and behold, the font has
changed to
what I had previously set with the IDLE parent.
Course, I can't import gmpy, cause the python.org version can't
compile it, so I
still have to use the macports install of 3.1, but that's ok, once I
use
the IDLE application to set the preferences, I can switch back to the
X11 version and the preferences will follow.

The prefs follow because all versions of IDLE use the same (unversioned)
directory for configuration files, ~/.idlerc/.  In particular, the
configuration file ~/.idlerc/config-main.cfg contains, among other
things, any changes to the default font.  So, if you're successful at
changing it in one version of IDLE, it will likely affect all versions
you have.  Note the file is a simple ini format:

[EditorWindow]
font = monaco

so you can edit it by hand.

Good to know. But, as the subject says...
BTW, the python.org IDLEs and the Apple-supplied IDLEs use the
system-supplied Aqua (aka Quartz) Tk not the X11 one that MacPorts
builds by default.  The MacPorts Tk port does have a "quartz" variant
but that doesn't yet work in 64-bit mode.

So, for all practical purposes, the macports install is broken also.

IDLE simply does not work in an X11 window (you think someone would
have noticed that). The missing preferences is just the beginning.
Apparently NONE of the menu item shortcuts work.

For example, the Cut, Copy, Paste shortcuts are given as Command-X,
Command-C and Command-V. But that doesn't work in an X11 window,
apperently only in an Aqua Tk (parent application appears as IDLE).

Of course, I can do Control-X, Control-C and Control-V to do Cut,
Copy and Paste. Don't know if this works for all shortcuts, but
I suppose I could just pick them from the menu (and I can bang
my head against the wall while I'm at it).

What do you think, suppose I copy the gmpy built with the macports
install over to the directory where the python.org version is? Would
it
import? If that'll work, I can switch back to using the python.org
install and use it's version of IDLE. I certainly won't be needing
distutils once I have a working version of gmpy.
 
N

Ned Deily

Mensanator said:
So, for all practical purposes, the macports install is broken also.

IDLE simply does not work in an X11 window (you think someone would
have noticed that). The missing preferences is just the beginning.
Apparently NONE of the menu item shortcuts work.

For example, the Cut, Copy, Paste shortcuts are given as Command-X,
Command-C and Command-V. But that doesn't work in an X11 window,
apperently only in an Aqua Tk (parent application appears as IDLE).

Of course, I can do Control-X, Control-C and Control-V to do Cut,
Copy and Paste. Don't know if this works for all shortcuts, but
I suppose I could just pick them from the menu (and I can bang
my head against the wall while I'm at it).

What do you think, suppose I copy the gmpy built with the macports
install over to the directory where the python.org version is? Would
it
import? If that'll work, I can switch back to using the python.org
install and use it's version of IDLE. I certainly won't be needing
distutils once I have a working version of gmpy.

Let's go back to your original problem, which, if I understand
correctly, was trying to get going with Python 3 and gmpy on OS X 10.6.
(Sorry I was away over the holidays and didn't get a chance to respond
to your original postings at the time.) I believe the problems you
originally encountered with installing gmpy were all due to a couple of
problems with building C extension modules on 10.6 when using the
current 3.1.1 OS X python.org. Unfortunately, 3.1.1 was released before
10.6 was so there are a couple of important fixes that haven't yet been
released for 3.1 (but are in the 2.6.4 installer which was released
after 10.6 came out). Fortunately, though, there are simple workarounds
for the problems. Keep in mind, though, that, at the moment, the
python.org installers for OS X are 32-bit only; that will change in the
future but if you do need a 64-bit Python 3 you'll need to stick to
other solutions like MacPorts for the time being.

First, make sure the gmp library you've installed has 32-bit support.
If you installed it using MacPorts, check with the file command:

$ file /opt/local/lib/libgmp.dylib
/opt/local/lib/libgmp.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libgmp.dylib (for architecture i386): Mach-O dynamically
linked shared library i386
/opt/local/lib/libgmp.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64

If it doesn't have an i386 variant, reinstall the gmp library from
MacPorts:

$ sudo port selfupdate # make sure MacPorts is up-to-date
$ sudo port clean gmp
$ sudo port install gmp +universal # install 32-/64-bit variants

Second, you need to install the MacOSX10.4u SDK because the current
python.org pythons are built with it. That SDK is included in the Snow
Leopard Xcode installer package but it is not installed by default.
There should be an Xcode.mpkg somewhere, perhaps on your hard disk if
your system came with Snow Leopard factory-installed or perhaps on a
restore DVD. If not, it's on the retail Snow Leopard DVD and can be
downloaded from the Apple Developer site. After launching the Xcode
installer, just select and install the "Mac OS 10.4 Support" package
from the Custom Install menu.

Third, you need to tell Distutils to use the older gcc-4.0 instead of
the gcc-4.2 which is now the default on 10.6.

$ cd /path/to/gmpy-1.11rc1
$ export CC=/usr/bin/gcc-4.0
$ /usr/local/bin/python3.1 setup.py install
....
$ /usr/local/bin/python3.1 test3/gmpy_test.py
Unit tests for gmpy 1.11
on Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
[GCC 4.0.1 (Apple Inc. build 5493)]
Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
....
1500 tests in 42 items.
1500 passed and 0 failed.
 
M

Mensanator

[...]




So, for all practical purposes, the macports install is broken also.
IDLE simply does not work in an X11 window (you think someone would
have noticed that). The missing preferences is just the beginning.
Apparently NONE of the menu item shortcuts work.
For example, the Cut, Copy, Paste shortcuts are given as Command-X,
Command-C and Command-V. But that doesn't work in an X11 window,
apperently only in an Aqua Tk (parent application appears as IDLE).
Of course, I can do Control-X, Control-C and Control-V to do Cut,
Copy and Paste. Don't know if this works for all shortcuts, but
I suppose I could just pick them from the menu (and I can bang
my head against the wall while I'm at it).
What do you think, suppose I copy the gmpy built with the macports
install over to the directory where the python.org version is? Would
it
import? If that'll work, I can switch back to using the python.org
install and use it's version of IDLE. I certainly won't be needing
distutils once I have a working version of gmpy.

Let's go back to your original problem, which, if I understand
correctly, was trying to get going with Python 3 and gmpy on OS X 10.6.  
Right.

(Sorry I was away over the holidays and didn't get a chance to respond
to your original postings at the time.)  

Hey, no problem. I bought this dingus with the idea I would
spend my the holiday time to get it to work. Boy, was I right.
I believe the problems you
originally encountered with installing gmpy were all due to a couple of
problems with building C extension modules on 10.6 when using the
current 3.1.1 OS X python.org.  

Yeah, I used the Mac disk image for Python 3.1.
Unfortunately, 3.1.1 was released before
10.6 was so there are a couple of important fixes that haven't yet been
released for 3.1 (but are in the 2.6.4 installer which was released
after 10.6 came out).  Fortunately, though, there are simple workarounds
for the problems.  Keep in mind, though, that, at the moment, the
python.org installers for OS X are 32-bit only;

I just checked, I was told to check sys.maxint but that doesn't exist,
I assume it's now sys.maxsize. On the python.org disk image, that
returns
'0x7fffffff'

looks like 32 bits.
that will change in the
future but if you do need a 64-bit Python 3 you'll need to stick to
other solutions like MacPorts for the time being.

The macports install of 3.1 gives:
'07x7fffffffffffffff'

so the macports must be 64 bits.
First, make sure the gmp library you've installed has 32-bit support.  

Uh, why would I want that? If it comes down to a choice between
IDLE and 64 bits, I'll live without IDLE.
If you installed it using MacPorts, check with the file command:

$ file /opt/local/lib/libgmp.dylib
/opt/local/lib/libgmp.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libgmp.dylib (for architecture i386):  Mach-O dynamically
linked shared library i386
/opt/local/lib/libgmp.dylib (for architecture x86_64):   Mach-O 64-bit
dynamically linked shared library x86_64

I get

/opt/local/lib/libgmpdylib: Mach-0 64-bit dynamically linked shared
library x86_64
If it doesn't have an i386 variant, reinstall the gmp library from
MacPorts:

But I only need that if I want to run the 32 bit version of Python
from python.org. If I'm willing to use the 64 bit version from
macports, I don't care, right?
$ sudo port selfupdate    # make sure MacPorts is up-to-date
$ sudo port clean gmp
$ sudo port install gmp +universal     # install 32-/64-bit variants

Second, you need to install the MacOSX10.4u SDK because the current
python.org pythons are built with it.

Then I'll just not use the download from python.org. Is there a way
to uninstall that disk image?
 That SDK is included in the Snow
Leopard Xcode installer package but it is not installed by default.  
There should be an Xcode.mpkg somewhere, perhaps on your hard disk if
your system came with Snow Leopard factory-installed or perhaps on a
restore DVD.  If not, it's on the retail Snow Leopard DVD and can be
downloaded from the Apple Developer site.  After launching the Xcode
installer, just select and install the "Mac OS 10.4 Support" package
from the Custom Install menu.

Third, you need to tell Distutils to use the older gcc-4.0 instead of
the gcc-4.2 which is now the default on 10.6.

$ cd /path/to/gmpy-1.11rc1
$ export CC=/usr/bin/gcc-4.0
$ /usr/local/bin/python3.1 setup.py install
...
$ /usr/local/bin/python3.1 test3/gmpy_test.py
Unit tests for gmpy 1.11
    on Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
[GCC 4.0.1 (Apple Inc. build 5493)]
Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
...
1500 tests in 42 items.
1500 passed and 0 failed.

It would appear that all the above is unnecessary, as I have
64 bit Python from macports working with the 64 bit version
of gmpy compiled by macports. Not only does it pass the unit
test, but since it's 64 bits, I can reach beyond the "outrageous
exponent error" that I've seen in 32 bit Windows versions. I'm
told that gmp can't do more than 48 billion decimal digits, so I
now hit that restriction before I reach the next level of
"outrageous exponent".

I just won't be able to properly run IDLE, but as I said, that's
expendable.

Anyway, thanks for pointing that out, didn't realize the python.org
disk image was 32 bits. There was no point in downloading it at all.

As I pointed out in the thread "the need for 64 bits", once I've
seen Paris, there's no going back.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top