Re: [pygame] File Copying

2007-07-08 Thread Ian Mallett
On 7/8/07, Ethan Glasser-Camp <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave LeCompte (really) wrote: > It's pretty simple to split your string on carriage returns (and/or line > feeds), create surfaces for each line of text, and blit those surfaces to > the desti

Re: [pygame] File Copying

2007-07-08 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dave LeCompte (really) wrote: > It's pretty simple to split your string on carriage returns (and/or line > feeds), create surfaces for each line of text, and blit those surfaces to > the destination surface. But this would be a nice addition to pygame

Re: [pygame] File Copying

2007-07-08 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> wrote: > Yes, I know, it just seems a little weird- text with no return function? > I'm probably just used to notepad and similar programs. Yeah, but you wouldn't want to compare a string-rendering function with a text editor. Think about what the rendering funct

Re: [pygame] File Copying

2007-07-08 Thread Ian Mallett
Yes, I know, it just seems a little weird- text with no return function? I'm probably just used to notepad and similar programs. On 7/8/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Ian Mallett wrote: > OK, that too bad. I don't suppose pygame has a suggestion box. > (Other than that in the

Re: [pygame] File Copying

2007-07-08 Thread Luke Paireepinart
Ian Mallett wrote: OK, that too bad. I don't suppose pygame has a suggestion box. (Other than that in the docs). You could easily write a class that did multi-line text. That's probably why it's not included in Pygame. All the text processing you need to do - centering text, word-wrap, etc. -

Re: [pygame] File Copying

2007-07-08 Thread Ian Mallett
OK, that too bad. I don't suppose pygame has a suggestion box. (Other than that in the docs). On 7/8/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Ian Mallett wrote: > New issue: If I do something like: > > font = pygame.font.SysFont("Times New Roman", 12) > FontObject = font.render("""th

Re: [pygame] File Copying

2007-07-08 Thread Luke Paireepinart
Ian Mallett wrote: New issue: If I do something like: font = pygame.font.SysFont("Times New Roman", 12) FontObject = font.render("""this is line 1 this is line 2 this is line 3""", 1, (255,255,255), (3,3,3)) surface.blit(FontObject, (0,0)) instead of putting a newline thing it puts a rectangle

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
New issue: If I do something like: font = pygame.font.SysFont("Times New Roman", 12) FontObject = font.render("""this is line 1 this is line 2 this is line 3""", 1, (255,255,255), (3,3,3)) surface.blit(FontObject, (0,0)) instead of putting a newline thing it puts a rectangle and a space. I rem

Re: [pygame] File Copying

2007-07-07 Thread Dave LeCompte (really)
I just said: > Win32's file handling handles certain characters specially: 0xff is > interpreted as an end-of-file marker Oops, forgive me on this. EOF is actually 0x1a, not 0xff. See also: http://mail.python.org/pipermail/python-list/2004-September/284028.html -Dave LeCompte

Re: [pygame] File Copying

2007-07-07 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> asked: > So that would explain why .png didn't work, but then why did it work with > .txt? Win32's file handling handles certain characters specially: 0xff is interpreted as an end-of-file marker, even if it occurs in the middle of the file, also carriage return/l

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
So that would explain why .png didn't work, but then why did it work with .txt? On 7/7/07, Richard Goedeken <[EMAIL PROTECTED]> wrote: That is correct; The 'b' is only necessary for Windows/DOS systems; under Unix all files are opened in Binary mode and the extra letter isn't required. Richard

Re: [pygame] File Copying

2007-07-07 Thread Richard Goedeken
That is correct; The 'b' is only necessary for Windows/DOS systems; under Unix all files are opened in Binary mode and the extra letter isn't required. Richard Ian Mallett wrote: > So like "rb", "wb", and"ab"? > > On 7/7/07, *Richard Jones* <[EMAIL PROTECTED] > > wrote

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
So like "rb", "wb", and"ab"? On 7/7/07, Richard Jones <[EMAIL PROTECTED]> wrote: On Sun, 8 Jul 2007, Ian Mallett wrote: > Like how? file("[Filepath]", "b") is invalid. % pydoc file Help on class file in module __builtin__: class file(object) | file(name[, mode[, buffering]]) -> file object

Re: [pygame] File Copying

2007-07-07 Thread Richard Jones
On Sun, 8 Jul 2007, Ian Mallett wrote: > Like how? file("[Filepath]", "b") is invalid. % pydoc file Help on class file in module __builtin__: class file(object) | file(name[, mode[, buffering]]) -> file object | | Open a file. The mode can be 'r', 'w' or 'a' for reading (default), | wri

Re: [pygame] File Copying

2007-07-07 Thread Rolando Pereira
Ian Mallett escreveu: Rolando, it works with .txt files. Strange, I tried with some images and it worked... -- _ ASCII ribbon campaign ( ) - against HTML email X & vCards / \

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
Thanks everybody! On 7/7/07, Ian Mallett <[EMAIL PROTECTED]> wrote: This works: import pygame import sys, os from pygame.locals import * import shutil def main(): shutil.copyfile("[SourceDir]", "[TargetDir]") main() On 7/7/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > > Like how? file("[F

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
This works: import pygame import sys, os from pygame.locals import * import shutil def main(): shutil.copyfile("[SourceDir]", "[TargetDir]") main() On 7/7/07, Ian Mallett <[EMAIL PROTECTED]> wrote: Like how? file("[Filepath]", "b") is invalid. On 7/7/07, Richard Jones <[EMAIL PROTECTED] >

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
Like how? file("[Filepath]", "b") is invalid. On 7/7/07, Richard Jones <[EMAIL PROTECTED]> wrote: On Sun, 8 Jul 2007, Rolando Pereira wrote: > f = file("full_path_to_blah.png") > n = file("full_path_to_Ogg.png", "w") # We add "w", so that if > the file

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
Rolando, it works with .txt files. Richard, John, I will look into that. On 7/7/07, John Popplewell <[EMAIL PROTECTED]> wrote: On Sat, Jul 07, 2007 at 10:45:30PM +0100, Rolando Pereira wrote: > Ian Mallett escreveu: > >Hi, > >Suppose you have an image file. Call it "blah.png". If I want to co

Re: [pygame] File Copying

2007-07-07 Thread Richard Jones
On Sun, 8 Jul 2007, Rolando Pereira wrote: > f = file("full_path_to_blah.png") > n = file("full_path_to_Ogg.png", "w") # We add "w", so that if > the file so that if the file > doesn't exist, it will b

Re: [pygame] File Copying

2007-07-07 Thread John Popplewell
On Sat, Jul 07, 2007 at 10:45:30PM +0100, Rolando Pereira wrote: > Ian Mallett escreveu: > >Hi, > >Suppose you have an image file. Call it "blah.png". If I want to copy it > >to another directory and rename it "Ogg.png", how would I do that with > >python code? > > > > Well, this is more of a [T

Re: [pygame] File Copying

2007-07-07 Thread Richard Jones
On Sun, 8 Jul 2007, Ian Mallett wrote: > Suppose you have an image file. Call it "blah.png". If I want to copy it > to another directory and rename it "Ogg.png", how would I do that with > python code? pydoc shutil.copyfile Richard

Re: [pygame] File Copying

2007-07-07 Thread Ian Mallett
OK, that worked the first time I tried it, but the file was not valid, i.e. corrupted. On 7/7/07, Rolando Pereira <[EMAIL PROTECTED]> wrote: Ian Mallett escreveu: > Hi, > Suppose you have an image file. Call it "blah.png". If I want to copy it > to another directory and rename it "Ogg.png", h

Re: [pygame] File Copying

2007-07-07 Thread Rolando Pereira
Ian Mallett escreveu: Hi, Suppose you have an image file. Call it "blah.png". If I want to copy it to another directory and rename it "Ogg.png", how would I do that with python code? Well, this is more of a [Tutor]'s question than a Pygame's question, but at least this one I can anwser. (

[pygame] File Copying

2007-07-07 Thread Ian Mallett
Hi, Suppose you have an image file. Call it "blah.png". If I want to copy it to another directory and rename it "Ogg.png", how would I do that with python code?