From taleinat at gmail.com Thu Mar 20 08:18:08 2008 From: taleinat at gmail.com (Tal Einat) Date: Thu, 20 Mar 2008 09:18:08 +0200 Subject: [Idle-dev] A solution. In-Reply-To: <10EC9205731A438FB35B1D98272F427C@Mark> References: <10EC9205731A438FB35B1D98272F427C@Mark> Message-ID: <7afdee2f0803200018r49331ae9q43fca49fd6776816@mail.gmail.com> Mark Fenton wrote: > > Tal wrote: >> >> Hello, >> >> If you used the normal Python installer in Windows, then you should be able >> to right-click any Python file, select "Edit with IDLE", and get what you >> want. >> >> (Note that this currently opens IDLE without a subprocess, which means that >> you won't be able to re-start the Python shell in IDLE without re-starting >> IDLE itself.) >> >> Changing what Windows does when you "start" a Python file (i.e. double-click >> it) is possible but not encouraged, and I don't know how exactly it can be >> done. Having double-click run the Python file (which is the what it >> currently does) is often useful, and it's consistent with what windows >> normally does with executable files such as .exe and .bat files. >> >> If you still want to change the double-click behavior, I can try to help you >> out. >> >> Hope this helps, >> - Tal >> > > Hi again Tal, > > It hasn't been a good week. So far this week my computer literaly blew up > right in front of me on Monday and I've been frantically trying to get back > back online (been offline for two days). Anyway, thanks for your input and > quite frankly I didn't know about the right click and edit option which is a > very handy option to have if one wants to edit and then run the program or > even to just run the program, and yes, it is a mystery about the "start" > thing isn't it because I've been googling for the last six months to find a > way to open the IDLE straight from the .py and run it, but there's nothing > on this anywhere whatsoever. > > I've re-read your email on Nabble and I've thought about a solution to my > own problem which may be in this very same area (my guess is probably wrong) > your orignal solution first, then my "solution" second: > > enable_shell = enable_shell or not edit_start > > Changed to: > > enable_shell = edit_start or not enable_shell > > Which is simply just the reverse of your suggestion. > > Failing that, I think it may have something to do with the "run" code that's > in IDLE which I presume to be in Pyshell.py or EditorWindow.py or somewhere > else. Have done some limited hacking in the EditorWindow.py area but are > afraid to do too much in this area as at one time the EditorWindow > completely disappeared somewhere and the Pyhton GUI icon on desktop wouldn't > start up at all so am reluctant to do any hacking without at first making a > backup copy of the orignal somewhere else on the computer in case whatever > it is I'm hacking on goes missing again. > > BTW, I forgot to sign my name (it hasn't been a good week) in my last email, > but this time I will. > > Thanks for your help. > Mark > Hi Mark, First of all, please notice that Nabble is just showing the idle-dev mailing list. However, when you mail me directly, your questions aren't sent to the mailing list, which is too bad since your questions and our answers may be useful to others in the future. If you have further questions regarding IDLE, I urge you send them directly to the mailing list: idle-dev at python.org. Now to "business". I don't quite understand what you're trying to achieve now - are you still trying to make double-clicking a Python file open that file for editing in IDLE? If so, you should start by learning how to change what Windows does when you double-click a file of a certain type. (look in Control Panel -> Folder Options -> File Types) My guess is that Windows lets you choose an executable, and then when you double-click a file of the appropriate type it runs that executable with the file's path as the first argument. Once you've figured this out, you'll need to make such an executable. You can use a batch file much like idle.bat (found inside Lib\idlelib), changed to use absolute (full) paths, like so: @echo off start c:\Python25\pythonw.exe c:\Python25\Lib\idlelib\idle.pyw %1 Save this with as a .bat file somewhere, and then tell Windows to use this .bat file to run .py files (in Folder Options). I just tried this now, and it works like a charm. Good luck! - Tal