[Tutor] TKinter and IDLE problem

Magnus Lycka magnus@thinkware.se
Thu Dec 12 04:12:05 2002


At 00:11 2002-12-12 -0800, Dick Moores wrote:
>Double clicking it in explorer works fine, but I can't get it to run from 
>a DOS window prompt. I have several Tkinker GUI scripts in a 
>C:\Python22\Tkinter directory, and have CD-ed to this directory in DOS. 
>dir shows the list of scripts, but when I try to run, for example, 
>C:\Python22\Tkinter\helloTkinter.py, I get "Bad command or file name". 
>What to do?

python C:\Python22\Tkinter\helloTkinter.py

If that also causes "Bad command or file name", add the path
to python.exe to your PATH variable in C:\AUTOEXEC.BAT. Something
like "SET PATH=%PATH%;C:\PYTHON22". You can do that in the
command line as well, but you need to change AUTOEXEC.BAT
and reboot to get it to stick.

>I'd like to follow Poor Yorick's tip, "I've been doing a lot of Tkinter 
>programming in Idle on Windows 2000, and I've found that the easiest way 
>to proceed is to keep a DOS window open to the folder where my python 
>source file is ..."
>
>BTW if it matters, I'm using Win98.

I think it does matter. The NT/Win2k/XP command shell cmd.exe is
much better than the bad old DOS command.com. (I don't think it
was even developed by Microsoft origianlly, but bought from some
manufacturer of DOS/Windows emulators. This makes sense, since
NT and friends needs to emulate DOS as well...)

C:\Python22\Tkinter\helloTkinter.py
Will work in BT/W2k, but
C:\Python22\Tkinter\helloTkinter.py some command line parameters
won't work as expected. sys.argv won't find the parameters. You
need to prepend "python" there as well. :(

Don't know about XP.


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se