Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Alan Gauld
On 16/08/11 07:52, Lisi wrote: On Tuesday 16 August 2011 00:48:08 Walter Prins wrote: >> So i installed python 2.7.1 on my linux and i bought a book that requires >> python 3 so installed python 3, and i used terminal and typed in python >> -V and it said 2.7.1 how do i get it to be 3 (i tried

Re: [Tutor] help in TKINTER

2011-08-16 Thread Alan Gauld
On 16/08/11 05:31, aditya wrote: Hello tutors, I wanted some help in using the Tkinter class for button creation, I am not able to add on click events i.e. when I press the button certain action should be performed for example if I press the button named 5, then it should display 5 in the text f

Re: [Tutor] directory within directory

2011-08-16 Thread Peter Otten
questions anon wrote: > I would like to open up a bunch of files within a folder within a folder > and then process them and output them in another location but with the > same folder structure. I seem to having trouble with the folder within > folder section. > I have a separate folder for each y

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Lisi
On Tuesday 16 August 2011 09:05:44 Alan Gauld wrote: > You might need to ensure that you have at least 1 version of Python2 around > because a lot of Linux tools are still written in v2 and might break if you > uninstall all v2 versions... Thanks for that, Alan. I knew that I had Python 2 by defa

[Tutor] Adding index numbers to tuple

2011-08-16 Thread Timo
Hello, Maybe a bit confusing topic title, probably the example will do. I have a tuple: t = ('a', 'b', 'c', 'd') And need the following output, list or tuple, doesn't matter: (0, 'a', 1, 'b', 2, 'c', 3, 'd') I tried with zip(), but get a list of tuples, which isn't the desired output. Anyone with

Re: [Tutor] Adding index numbers to tuple

2011-08-16 Thread Martin A. Brown
Hello, : Maybe a bit confusing topic title, probably the example will do. : : I have a tuple: : t = ('a', 'b', 'c', 'd') : And need the following output, list or tuple, doesn't matter: : (0, 'a', 1, 'b', 2, 'c', 3, 'd') : : I tried with zip(), but get a list of tuples, which isn't the d

Re: [Tutor] Adding index numbers to tuple

2011-08-16 Thread Christian Witts
On 2011/08/16 03:10 PM, Timo wrote: Hello, Maybe a bit confusing topic title, probably the example will do. I have a tuple: t = ('a', 'b', 'c', 'd') And need the following output, list or tuple, doesn't matter: (0, 'a', 1, 'b', 2, 'c', 3, 'd') I tried with zip(), but get a list of tuples, which

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Alan Gauld
On 16/08/11 10:14, Lisi wrote: On Tuesday 16 August 2011 09:05:44 Alan Gauld wrote: > You might need to ensure that you have at least 1 version of Python2 around > because a lot of Linux tools are still written in v2 and might break if you > uninstall all v2 versions... Thanks for that, Alan.

Re: [Tutor] Adding index numbers to tuple

2011-08-16 Thread Hugo Arts
On Tue, Aug 16, 2011 at 3:42 PM, Christian Witts wrote: > On 2011/08/16 03:10 PM, Timo wrote: > > Hello, > Maybe a bit confusing topic title, probably the example will do. > > I have a tuple: > t = ('a', 'b', 'c', 'd') > And need the following output, list or tuple, doesn't matter: > (0, 'a', 1, '

[Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Jeff Peters
Hi; I am trying to run a function inside a continuing loop, but do not seem to be able to pass any parameters (arguments ) when I do so. I have placed working and non-working code , with output below. ## This works: def loop(fn ): for i in range(5): fn( ) def this_function(a=" i

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Giovanni Tirloni
On Tue, Aug 16, 2011 at 1:44 PM, Jeff Peters wrote: > Hi; > > I am trying to run a function inside a continuing loop, but do not seem to > be able to pass any parameters (arguments ) when I do so. > I have placed working and non-working code , with output below. > > ## This works: > > def loop(fn

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Peter Otten
Jeff Peters wrote: > Hi; > > I am trying to run a function inside a continuing loop, but do not seem > to be able to pass any parameters (arguments ) when I do so. > I have placed working and non-working code , with output below. > > ## This works: > > def loop(fn ): > for i in range(5): >

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Prasad, Ramit
>def loop(fn ): > for i in range(5): > fn( ) > >def this_function(a=" i am not a string"): > print( a ) > >loop(this_function("I am a string") ) ## note the only change is here > >## With this as output: > > >>> >I am a string >Traceback (most recent call last): > File "/home/je

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Jeremy G Clark
@ Connor -- you probably should heed the advice of Alan and leave your existing Python 2.x install alone. For the exercises in your book, you should be able to include this line at the top of every script and it'll work just fine. I can't remember, you may need to chmod +x in order for this to

Re: [Tutor] Passing functions(with parameters) as paramiters to (looping)functions.

2011-08-16 Thread Jeff Peters
On 08/16/2011 01:46 PM, Peter Otten wrote: Jeff Peters wrote: Hi; I am trying to run a function inside a continuing loop, but do not seem to be able to pass any parameters (arguments ) when I do so. I have placed working and non-working code , with output below. ## This works: def loop(fn ):

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Prasad, Ramit
> I can't remember, you may need to chmod +x in order for this to work. Anyone? You need to chmod if you want to call the script via shebang (./script.py). If you are calling it by doing 'python3 script.py' then you do not need it as python3 should already be executable. Ramit Ramit Prasad |

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Jeremy G Clark
Yes, that's what I was trying to say. Thanks for translating! :) -Original Message- From: Prasad, Ramit [mailto:ramit.pra...@jpmorgan.com] Sent: Tuesday, August 16, 2011 11:24 AM To: Jeremy G Clark; tutor@python.org Subject: RE: [Tutor] which version do i have and how do i change it > I

[Tutor] Message: pygobject_register_sinkfunc is deprecated (GtkWindow)

2011-08-16 Thread Susana Iraiis Delgado Rodriguez
Hello List! I just started to use PyGTK and Glade to create graphical interfaces, my python interpreter version is 2.6.6; I also install the GTK2 Runtime enviroment and Glade 3.6.6. I also installed in my computer pycairo-1.8.10.win32-py2.6.exe, pygobject-2.26.0-1.win32-py2.6.exe and pygtk-2.16.0+

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Lisi
On Tuesday 16 August 2011 17:06:42 Alan Gauld wrote: > It can be hard to tell, sometimes distro designers just think something > is useful. lisi@Tux:~$ aptitude why python i reportbug Depends python (>= 2.5) lisi@Tux:~$ !! Lisi ___ Tutor maillist -

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Lisi
On Tuesday 16 August 2011 17:06:42 Alan Gauld wrote: > My concern was that if they uninstalled 2.7 the default would revert to > 2.6 (or > whatever) and they might then be tempted to uninstall that too! Yes - mea culpa for not realising that. Mind you, if I had investigated my own system I would

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Jerry Hill
On Tue, Aug 16, 2011 at 4:35 PM, Lisi wrote: > lisi@Tux:~$ aptitude why python > i   reportbug Depends python (>= 2.5) > lisi@Tux:~$ Keep in mind that that command only shows you a single dependency chain. Try again with "aptitude -v why python" to see all of the dependencies. On my ubuntu 11.0

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Lisi
On Tuesday 16 August 2011 21:53:46 Jerry Hill wrote: > On Tue, Aug 16, 2011 at 4:35 PM, Lisi wrote: > > lisi@Tux:~$ aptitude why python > > i   reportbug Depends python (>= 2.5) > > lisi@Tux:~$ > > Keep in mind that that command only shows you a single dependency > chain.  Try again with "aptitude

Re: [Tutor] directory within directory

2011-08-16 Thread questions anon
Thank you, that does create the directories in the new place but when I process the data it does not put the outputs in the correct directory they all end up in the last directory created. Below is the code of what I am trying to do. Any feedback will be greatly appreciated. from netCDF4 import Da

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Steven D'Aprano
Connor Merritt wrote: So i installed python 2.7.1 on my linux and i bought a book that requires python 3 so installed python 3, and i used terminal and typed in python -V and it said 2.7.1 how do i get it to be 3 (i tried deleting it but i couldn't what should i do?) At the terminal, type pytho

Re: [Tutor] numpy.mean across multiple netcdf files

2011-08-16 Thread questions anon
Thanks Andre I had a go at following your advice but it didn't seem to work (it kept focusing on the last loop and not combining them all together) so I have posted a note on scipy user group instead (code below). Also thanks for the advice regarding averaging! from netCDF4 import Dataset import

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Alan Gauld
On 16/08/11 21:53, Jerry Hill wrote: ... Try again with "aptitude -v why python" to see all of the dependencies. On my ubuntu 11.04 machine, that command produces over 9000 lines of output, And on my 10.04 LTS PC it gives too many lines to scroll back to the top (actually 1645 , I just check

Re: [Tutor] Tkinter: no module named messagebox

2011-08-16 Thread brandon w
On 08/14/2011 02:29 AM, Peter Otten wrote: brandon w wrote: On 08/13/2011 04:49 PM, Peter Otten wrote: How do I find the modules in Tkinter? The simplest approach is probably to explore your file system: Step 1: where's Tkinter? $ python -c 'import Tkinter, os; prin

Re: [Tutor] Tkinter: no module named messagebox (brandon w)

2011-08-16 Thread brandon w
On 08/14/2011 03:10 AM, Robert Sjoblom wrote: I have tried to follow the tutorial I found here: Python 2.7 Tutorial http://www.youtube.com/watch?v=uh6AdDX7K7U This is what I have done so far: #!/usr/bin/python from Tkinter import * import Tkinter.MessageBox I figured I might as well, g

Re: [Tutor] Tkinter: no module named messagebox (brandon w)

2011-08-16 Thread brandon w
On 08/14/2011 11:14 AM, Alan Gauld wrote: On 14/08/11 14:07, Wayne Werner wrote: Of course I personally I usually do import Tkinter as tk Which means I only have to type 3 extra characters, but it removes any ambiguity - tk.Something had to come from Tkinter Thats exactly what I tend to do n

[Tutor] Printing in the same place

2011-08-16 Thread brandon w
I am trying to print in the same place to make a clock in a tkinter window. I will loop the following code to update the time. This seems to work but it is not printing in the same place: #!/usr/bin/python #Python 2.6.6 import time for t in range(5): digits = time.strftime('%H:%M:%S')