New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Turtle with IDLE on Mac OS X #55284
Comments
Info: I have Python 2.7.1:86832 (32-bit) installed using ActiveState Tcl/Tk 8.5.9 on Mac OS X 10.6 Problem: However, when said Python script is run from the Terminal, the window is completely responsive. I believe this to be some sort of problem with the IDLE.app Things that I have tried: Other things that may be useful: It is quite annoying to not be able to use the IDLE to create and test programs using the turtle module. Please help. |
Since IDLE and the turtle modules both use Tkinter and thus are both Tcl/Tk applications, it wouldn't be surprising if you had problems trying to run a program using the IDLE module from within IDLE. However, I find I can successfully run at least one of the supplied Turtle demos from IDLE 2.7.1 and IDLE 2.6: cd /Applications/Python 2.7/Extras/Demo/turtle and with either of the two IDLE variants (32-bit -> Tk 8.4, 64-/32-bit -> Tk 8.5). Can you supply a simple script to demonstrate the problem you see? Keep in mind that, at the moment, neither of the standard python.org 2.7.1 installers support using ActiveState Tk 8.5.9. The 32-bit-only installer will use ActiveState Tk 8.4, if installed, otherwise use the Apple-supplied Tk 8.4.19(?) in 10.6. Python 2.7.1 was released before a 64-bit capable version of ActiveState Tk 8.5 was available so, as released, it will only link to the Apple-supplied Cocoa Tk 8.5.7 in 10.6 and that version has proven to be very unreliable when used with IDLE. You should be able to build from source a Python 2.7.1 that will link to ActiveState 8.5.9 if it is present during the build but beware that there are a number of issues both major and minor that have been recently fixed in Python (and are in the current release-2.7 maintenance branch that should appear as a 2.7.2 release in the future) as well as a few issues in Cocoa Tk itself which should be fixed in an upcoming release of ActiveState Tk 8.5. |
er, "trying to run a program using the turtle module from within IDLE" |
It may be because the program that I am trying to run automatically exits, I do not know yet how to keep a turtle program running (waiting for input). The only way I know so far is to use the function "exitonclick()," but when using that, my I cannot use any other mouseevents in my program. (Help?) Anyways, an example of a script that will cause turtle to hang/crash is even such a simple one as: Another quick question that you don't have to answer: is there anyway to ignore interaction (keystrokes, mouseclicks) while an onkey function is activated? Like if I make a function that takes 10 seconds to complete, can I ignore all interaction while that function is being run? Thank you for your time. |
Well, the bug tracker isn't really the place to get help on using Python. I would suggest posting to python-list, you are more likely to find people with the time to help you there. You should also take a look at the Turtle demo programs, I'm pretty sure you can find your answers there as I know some of them are interactive. Turtle is designed to work from IDLE, so if it doesn't it's a bug. You haven't mentioned an actual crash of the python interpreter, so I'm changing the type to behavior. |
Sorry to keep bothering, but running Python 2.7.1:88286 (maintenance) on ActiveState Tcl/Tk 8.5.9 causes the idle to hang when a simple script like: Relating to this, I don't know if it is proper to ask here, but is it possible to link Python to a specific Tcl/Tk when compiling from the source? Note: When running Python 2.7.1 (32-bit from installer) with Tcl/Tk 8.4, the above problem is not there. |
Now that I looked at the documentation (http://docs.python.org/library/turtle.html), I see that it is clear that Turtle is designed to work from IDLE *but*, as is noted, "when using the module from within IDLE run with the -n switch", which means run IDLE without a subprocess. What may not be so obvious is how to do that on Mac OS X. Double-clicking on IDLE.app launches it with default values including a subprocess and there is no straightforward to override those. From a terminal shell, it is easy to start bin/idle: $ idle2.7 -n although that has a few cosmetic disadvantages with bin/idle over IDLE.app (for example, the application name displayed is "Python" not "IDLE"). It has aways been possible to launch an OS X GUI app from a shell command line using the open(1) command; as of OS X 10.6 it is now also possible to pass regular command line arguments to the application. So the following would work in 10.6 and probably be preferable: $ open -a "/Applications/Python 2.7/IDLE.app" --args -n If you want to have a double-clickable application, a simple approach is to create a launcher application with AppleScript: $ osacompile -o 'IDLE-n.app' <<EOF
> do shell script "open -a '/Applications/Python 2.7/IDLE.app' --args -n"
> EOF As someone not used to using Turtle and given the intended user base for Turtle, I wonder whether the current Turtle module documentation is sufficient on this point. Two possible actions I could see are: (1) expanding the documentation to include a suggestion like the above to allow for an OS X clickable app; and/or (2) actually supplying such a simple no-subprocess app with the standard python.org installer distribution (or some other solution). How is this issue handled on Windows? Is there a need to expand the documentation in general? |
[Please don't add new topics to the same tracker issue. As David mentioned, it would be better to ask for help on one of the user lists to be sure before opening an issue. Besides the general python-list, there is an active OS X users list (pythonmac-sig) where you will find users of IDLE; see http://www.python.org/community/sigs/ That said, to address your most recent message, that appears to indeed be a problem. I've opened bpo-11088 for it. The "setCanCycle: is deprecated" messages are a harmless artifact; they should disappear in an upcoming maintenance release of ActiveState Tcl 8.5.] |
Ned: I read the bits in the turtle docs about -n as meaning *if* you use -n *then* you should set this profile option (but if you don't, things should work). I didn't go over the docs in detail, though, so maybe I'm misreading. Since you and I clearly don't know what we are talking about in detail, I'm adding Gregor and Alexander (the latter since he's clearly been using it) to nosy. |
It's clear from testing it and from some searches that -n is, in fact, required. |
Ah, in that case I think the docs could be improved on that point. |
I saw this post by Gregor: http://thread.gmane.org/gmane.comp.python.general/334881/focus=334996 I don't know applicable it still is on Windows. But it does seem to be still true on OS X. |
Thank you so much for pointing out the -n option! |
solved* or rather, a workaround has been found. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: