Re: [Tutor] Making Incremental Filenames

2007-07-10 Thread Luke Paireepinart
Brian Hicks wrote: > Hi, I'm making a webcam automation script (for a project 365 photo > thing) and I can't figure out how to increment the filename every time > the script saves an image. I'm using this snippet of code to count > the tiles in the directory: > > filecount = len(os.walk("C:

Re: [Tutor] Making Incremental Filenames

2007-07-10 Thread John Fouhy
On 11/07/07, Brian Hicks <[EMAIL PROTECTED]> wrote: > Hi, I'm making a webcam automation script (for a project 365 photo thing) > and I can't figure out how to increment the filename every time the script > saves an image. I'm using this snippet of code to count the tiles in the > directory: [...

[Tutor] Making Incremental Filenames

2007-07-10 Thread Brian Hicks
Hi, I'm making a webcam automation script (for a project 365 photo thing) and I can't figure out how to increment the filename every time the script saves an image. I'm using this snippet of code to count the tiles in the directory: filecount = len(os.walk("C:\Users\Username\Desktop").next

Re: [Tutor] Bundle help!

2007-07-10 Thread Sara Johnson
Alan Gauld <[EMAIL PROTECTED]> wrote:"Sara Johnson" wrote > this is sort of a script that was written and I'm making > modifications to. Due to my serious lack of experience, > I'm afraid to rewrite anything. This is probably a long shot given the code you've posted so far, but I don't

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
I will work with this further, and report back once I find Alan's method... but for now, this seems to work: for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip("\' E").rstrip("

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote > you can see what my problem was: > > for i in range(0,344) > y=d[i][2].split('\xb0') > x=d[i][3].split('\xb0') > ... > declon=int(xdeg)+(float(xmin)/60) The first thing I'd suggest is not to try to do it all in one step. Break it into chunks and wri

Re: [Tutor] back on bytes

2007-07-10 Thread Terry Carroll
On Sat, 7 Jul 2007, Alan Gauld wrote: > I'm intrigued as to why people are using weird combinations > of math to manipulate bitstrings given that Python has a full > set of bitwise operators. Surely it is easier and more obvious > to simply shift the bits right or left using >> and << and use > bi

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
A little closer, this seems to work, but it's not catching the 'W' or 'S' cases to make it negative... for i in range(0,20): y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=int(y[0].rstrip()),float(y[1].strip('\' N')) xdeg,xmin=int(x[0].rstrip()),float(x[1].rstrip("\' E").rstrip

[Tutor] Question about lambda and new.instancemethod

2007-07-10 Thread Tino Dai
Hi Everybody, I have been working on a parser for myself. I want to create methods on the fly with the information that I get from a file. Here is my question: class configure: <.stuff deleted..> def parseGlobal(self,projectName,section,project): for ele

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Tino Dai
On 7/10/07, John <[EMAIL PROTECTED]> wrote: I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344) y=d[i][2].split('\xb0') x=d[i][3].spli

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
Luke, Albert: Thanks.. yes I'm thinking re is what I need... and using negative values for west, and positive for east is our convention. The problem I have is that not all the data was provided in that format, so I'm in the process of converting... There are a number of problems with my origina

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Luke Paireepinart
John wrote: > Just a quick follow up.. it doesn't work :s > > There are definitely some problems... ideas are welcome! I have an idea: use a regular expression :D Unfortunately, I don't have the knowledge of these down well enough to just spout one off OTOH, and I've got somewhere I have to be,

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
Just a quick follow up.. it doesn't work :s There are definitely some problems... ideas are welcome! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] An interesting case... of east vs. west

2007-07-10 Thread John
I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344) y=d[i][2].split('\xb0') x=d[i][3].split('\xb0') ydeg,ymin=y[0].strip(),y[1].rstrip(

Re: [Tutor] writing over text

2007-07-10 Thread max .
thank you so much :) On 7/10/07, Bob Gailer <[EMAIL PROTECTED]> wrote: max . wrote: > hello i am writing a population script and was wondering if i can > just keep writing to the same line instead of printing a new line > every second import time for i in range(5): print chr(13), i,

Re: [Tutor] writing over text

2007-07-10 Thread Bob Gailer
max . wrote: > hello i am writing a population script and was wondering if i can > just keep writing to the same line instead of printing a new line > every second import time for i in range(5): print chr(13), i, time.sleep(1) # chr(13) = carriage return, and the trailing , suppress

Re: [Tutor] writing over text

2007-07-10 Thread Alan Gauld
"max ." <[EMAIL PROTECTED]> wrote > hello i am writing a population script and was wondering if i can > just keep > writing to the same line instead of printing a new line every second Depending on the terminal type you can use control codes to move the cursor. Thus on most Unix terminals you c

Re: [Tutor] font colours

2007-07-10 Thread Alan Gauld
"Dave Pata" <[EMAIL PROTECTED]> wrote > I am currently doing an assignment for school using python > and im at the stage of make it look good and i need more > colours. More colours rarely means it looks good, just garish! Good UI's are built by following style guidelines that allow the user

[Tutor] writing over text

2007-07-10 Thread max .
hello i am writing a population script and was wondering if i can just keep writing to the same line instead of printing a new line every second thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Code query..works in IDLE but not DrPython editor

2007-07-10 Thread Alan Gauld
"Tony Noyeaux" <[EMAIL PROTECTED]> wrote > import randomprint random.choice(['Apple', 'Pear', 'Shrimp', > 'Death', 'Life']) Your formatting is a little strange as seen above but... > Works in IDLE gui, no problem. Do you mean the interactive shell in IDLE? Or are you actually comparing like fo

Re: [Tutor] Code query..works in IDLE but not DrPython editor

2007-07-10 Thread Dave Kuhlman
On Tue, Jul 10, 2007 at 01:37:34PM -0400, Tony Noyeaux wrote: > > Simple Random code. > > > import randomprint random.choice(['Apple', 'Pear', 'Shrimp', 'Death', 'Life']) > > > Works in IDLE gui, no problem. Gives me a random pick no problem. > > When i changed to DrPython, to continue b

[Tutor] Code query..works in IDLE but not DrPython editor

2007-07-10 Thread Tony Noyeaux
Simple Random code. import randomprint random.choice(['Apple', 'Pear', 'Shrimp', 'Death', 'Life']) Works in IDLE gui, no problem. Gives me a random pick no problem. When i changed to DrPython, to continue building parts of my code.. it won't take that code. Gives me this error. C:/P

Re: [Tutor] GUI backgrounds using Tk

2007-07-10 Thread Alan Gauld
"Dave Pata" <[EMAIL PROTECTED]> wrote > I was wondering if anyone knows how to insert graphic images, > such as JPEG and BMP, into a simple Tk GUI and use them > as the background. Any help will be appreciated. since its for homework onl;y hints are allowed. You need to look at the Image obje

Re: [Tutor] Integer to binary

2007-07-10 Thread Alan Gauld
"Mihai Iacob" <[EMAIL PROTECTED]> wrote > Is there a function that converts from integer to > binary (or a module that handles this)? Remember that integers are binary. Thats how they are stored. What I think you want is something that will represent an integer as a string of 1s and 0s. Somethin

Re: [Tutor] file methods

2007-07-10 Thread Dave Kuhlman
On Tue, Jul 10, 2007 at 08:24:36AM -0400, bhaaluu wrote: > Thank you for the clarification. > One pitfall of experimentation as a Noob is in not knowing enough to > figure out what or why errors are generated. Thus, this Tutor list is very > helpful. I really appreciate the feedback. > You might

Re: [Tutor] Integer to binary

2007-07-10 Thread Dick Moores
At 07:27 AM 7/10/2007, Mihai Iacob wrote: >Hello, > >Is there a function that converts from integer to >binary (or a module that handles this)? > >The only thing close to it that i found in the manual >is the binascii module but i can't get it to work. Here's one: def base10ToBaseN(n, base=2):

[Tutor] Integer to binary

2007-07-10 Thread Mihai Iacob
Hello, Is there a function that converts from integer to binary (or a module that handles this)? The only thing close to it that i found in the manual is the binascii module but i can't get it to work. Thanks _

Re: [Tutor] file methods

2007-07-10 Thread Mike Hansen
> -Original Message- >[...] > I have a file like this one: > > command = func_babara > parameter_1 = 300 > parameter_2 = 300 > parameter_3 = 50 > parameter_4 = 0 > parameter_5 = 0 > parameter_6 = 0 > > > ,as you see, i need to process it one line at a time and use > this .ini file

Re: [Tutor] file methods

2007-07-10 Thread bhaaluu
Greetings, On 7/9/07, John Fouhy <[EMAIL PROTECTED]> wrote: > On 10/07/07, bhaaluu <[EMAIL PROTECTED]> wrote: > > >>> file.readlines() > > Traceback (most recent call last): > > File "", line 1, in ? > > AttributeError: 'str' object has no attribute 'readlines' > > This error here is caused by t

[Tutor] GUI backgrounds using Tk

2007-07-10 Thread Dave Pata
Hello,   I was wondering if anyone knows how to insert graphic images, such as JPEG and BMP, into a simple Tk GUI and use them as the background. Any help will be appreciated.   Cheers.Crowded House Time on Earth – catch them live in the USA! Enter here. __

[Tutor] font colours

2007-07-10 Thread Dave Pata
Hello, I am currently doing an assignment for school using python and im at the stage of make it look good and i need more colours. So if anyone has URL with a list of colours, or even a list established by yourself. Anything of the sort would be appreciated. P.S I dont know if this has any effect

Re: [Tutor] file methods

2007-07-10 Thread Alan Gauld
"elis aeris" <[EMAIL PROTECTED]> wrote > python 3.9 File Objects of Python Library Reference > Learning to program from the reference manual is possible, especially if you use the interpreter to experiment as John has suggested. But it will be much faster and less error prone if you just work th

Re: [Tutor] file methods

2007-07-10 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote >> The best way to find out what the functions do is to experiment >> with them. >> >> eg: >> >> >>> f = open('text.txt', 'r') >> >>> f.readlines() >> >> and look at the output. > > I like that idea. I made a simple english plain text file, thus: > > first lin