Re: [Tutor] Tkinter and python
> python on the command prompt/bash shell the script gets> executed.Hey Dave,Thanks for correcting me. I should read what I am writing before I hit the send button :). It was a stupid mistake.. Appending path to PYTHONPATH will allow us to import the module in some other Python script without requiring us to do sys.path.apend(). To execute the script from bash what Dave suggests is correct.Also, if you don't want to append path to PYTHONPATH you can also place the module under site-packages directory under Python home directory. Thanks,- AOn 10/8/06, Dave Kuhlman <[EMAIL PROTECTED]> wrote: On Sun, Oct 08, 2006 at 08:36:31PM +0530, Arun Kumar PG wrote:> Hi,>> You can try:>> >>import sys> >>sys.path.append('')> >>import < module.py>>> Or else you can append the path to global PYTHONPATH environment variable> and whenever you will type:>> python on the command prompt/bash shell the script gets > executed.>Not true, if I understand you correctly. PYTHONPATH affects wherePython looks for modules to be imported. But if I type thefollowing at the command line:$ python mymodule.py it is the shell (in my case bash) that looks for mymodule.py, notPython. It analogous to my typing:$ vi mymodule.pyor (trying to avoid a fight between vi and emacs fanatics):$ emacs mymodule.pyNeither vi nor emacs try to find mymodule.py; the (bash or other)shell does.So perhaps a solution to the problem is to make mymodule.pyexecutable and put it somewhere on your path. Then execute it by typing at the command line:$ mymodule.pyNow the shell will run it just like any other executable script andit will use Python as the interpreter for that script.How you make the script executable probably depends on which shell you are using. For bash, you could do the following:1. Insert the following line as the first line of your script: #!/usr/bin/env python2. Change the priveleges of the script to make it executable. Example: $ chmod u+x mymodule.py3. Put mymodule.py on your path, that is, in a directory that is in your PATH environment variable. Alternatively, add the path to the directory containing mymodule.py to your PATH environment variable.Dave--Dave Kuhlmanhttp://www.rexx.com/~dkuhlman___ Tutor maillist - Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter and python
On Sun, Oct 08, 2006 at 08:36:31PM +0530, Arun Kumar PG wrote: > Hi, > > You can try: > > >>import sys > >>sys.path.append('') > >>import > > Or else you can append the path to global PYTHONPATH environment variable > and whenever you will type: > > python on the command prompt/bash shell the script gets > executed. > Not true, if I understand you correctly. PYTHONPATH affects where Python looks for modules to be imported. But if I type the following at the command line: $ python mymodule.py it is the shell (in my case bash) that looks for mymodule.py, not Python. It analogous to my typing: $ vi mymodule.py or (trying to avoid a fight between vi and emacs fanatics): $ emacs mymodule.py Neither vi nor emacs try to find mymodule.py; the (bash or other) shell does. So perhaps a solution to the problem is to make mymodule.py executable and put it somewhere on your path. Then execute it by typing at the command line: $ mymodule.py Now the shell will run it just like any other executable script and it will use Python as the interpreter for that script. How you make the script executable probably depends on which shell you are using. For bash, you could do the following: 1. Insert the following line as the first line of your script: #!/usr/bin/env python 2. Change the priveleges of the script to make it executable. Example: $ chmod u+x mymodule.py 3. Put mymodule.py on your path, that is, in a directory that is in your PATH environment variable. Alternatively, add the path to the directory containing mymodule.py to your PATH environment variable. Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter and python
max . wrote: > first off i just started looking for Tkinter tutorials but havent found > much and what i have found was not very good if anyone knows og any > Tkinter tutorials pleas let me know Try this for a good tutorial http://www.pythonware.com/library/tkinter/introduction/ Peace. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter and python
Hi,You can try:>> import sys>> sys.path.append('')>> import Or else you can append the path to global PYTHONPATH environment variable and whenever you will type: python on the command prompt/bash shell the script gets executed.Hope that helps.Thanks,- Arun On 10/8/06, max . <[EMAIL PROTECTED]> wrote: first off i just started looking for Tkinter tutorials but havent found muchand what i have found was not very good if anyone knows og any Tkintertutorials pleas let me knowsecond is thair anyway to change the path that python looks for a program in ex: if i enter python hello into the command line then i get this error/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python:can't open file 'hello1': [Errno 2] No such file or directory can i chage that search path?if so how?thx^_^" s33 y4_Search—Your way, your world, right now! http://imagine-windowslive.com/minisites/searchlaunch/?locale=en-us&FORM=WLMTAG___Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor