Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread Pierre Barbier de Reuille
I do not understand why you don't want the so simple fork/exec pattern ! In UNIX programming this is the way to go ... I cannot think of anything simpler than that : for i in xrange( 10 ): pid = os.fork() if not pid: os.execv( "/bin/echo", [ "echo", "toto" ] ) try: while True: os.wait

Re: [Tutor] properties and subclasses

2005-04-26 Thread Kent Johnson
Brian van den Broek wrote: Hi all, I'm trying to get a hang of properties. It isn't quite clear to me what is the best way to make properties differ in subclasses. Some code snips to show what I've tried: I can get what I want this way: class A(object): ... def __init__(self): pass ... def

Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread Kent Johnson
chumpy town wrote: Hello all, I am trying to convert from bash to python for scripting. What is the simplest & cleanest way to do the following in python: #!/bin/bash for i in `seq 1 1000` do my-other-script & done wait echo "all done" You might like the subprocess module - something like this

[Tutor] custom package structure?

2005-04-26 Thread Kristian Rink
Hi all; currently I am trying to get some structure into my Python / SOAP project now that the threading issue is gone (thanks lots, Kent!); so I created a package structure and __init__.py files according to [1], so my project tree looks somewhat like this: $PROJECTROOT /start.py /Server /Ser

Re: [Tutor] custom package structure?

2005-04-26 Thread Kent Johnson
Kristian Rink wrote: Hi all; currently I am trying to get some structure into my Python / SOAP project now that the threading issue is gone (thanks lots, Kent!); so I created a package structure and __init__.py files according to [1], so my project tree looks somewhat like this: $PROJECTROOT /st

Re: [Tutor] properties and subclasses

2005-04-26 Thread Brian van den Broek
Kent Johnson said unto the world upon 2005-04-26 06:24: Brian van den Broek wrote: Hi all, I'm trying to get a hang of properties. It isn't quite clear to me what is the best way to make properties differ in subclasses. Some code snips to show what I've tried: I can get what I want this way: class

Re: [Tutor] custom package structure?

2005-04-26 Thread Kristian Rink
Hi Kent; ...and thanks loads for your mail. Once again it helped me pretty much figuring out what my mistake was like. On Tue, 26 Apr 2005 08:31:13 -0400 Kent Johnson <[EMAIL PROTECTED]> wrote: > No, everything above looks fine. Please post the exact error message > you are getting (copy / pas

RE: [Tutor] using TK to view an image and then close the window

2005-04-26 Thread Ertl, John
Michael, Thanks for the understanding and help, It works kind of. I was getting this error with one of my iterations of the code as well. Do you know what might be causing this? Since your code also produced this I figured Oh-Well and I just put in a try and this at least keeps the error from

[Tutor] Tkinter and Animation

2005-04-26 Thread Jeremiah Rushton
In a program that I'm writing in Tkinter, I wanted to know how to animate objects.  I have three buttons in the beginnig, all in the center.  I wanted to know how to, when the user clicks one of them, make them small and move to a top corner and then have a text box appear where they were. Thanks

Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread chumpy town
Thanks Pierre & Kent. The subprocess.Popen worked beautifully. -david On 4/26/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > chumpy town wrote: > > Hello all, > > I am trying to convert from bash to python for scripting. What is the > > simplest & cleanest way to do the following in python: > >

Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread Alan Gauld
> #!/bin/bash > for i in `seq 1 1000` > do > my-other-script & > done > wait > echo "all done" > > ...Alternatively, I know I can use os.fork(), os.exec() > and os.wait() but this seems cumbersome. Bash is optimised for process control, in that it excels. For general purpose programming it i

Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread Alan Gauld
> You might like the subprocess module - something like this (untested!): Yikes, even more batteries. When did that appear, I've never seen it before! - Aha! Its 2.4 that's why I havemn't seen it, as ever I am one release behind the bleeding edge on 2.3... > from subprocess import Popen > procs =

Re: [Tutor] properties and subclasses

2005-04-26 Thread Alan Gauld
> I had found the first thread you linked. I see what you mean about the > cure -- my general belief is that *I* am unlikely to have problems > for which meta-classes are really the best solution :-) Once you get used to them meta-classes are very useful. In fact I have never built an industrial

Re: [Tutor] python's bash wait and ampersand equivalent?

2005-04-26 Thread Kent Johnson
Alan Gauld wrote: from subprocess import Popen procs = [ Popen("my-other-script") for i in range(1000) ] for p in procs: p.wait() p.wait will be called for each process in the list so its not quite the same as a single os.wait but then that might be what's wanted! I'm not sure but from the docs

Re: [Tutor] Re Help with this script

2005-04-26 Thread John Carmona
Hi Alan, sorry for not replying sooner I am right in the middle of setting up a network at home. Thanks for your email. OK the situation is that I haven't still found out what the answer is, I have noticed in the other hand that if I select the option "a" let's say 4 times, I need to enter the

Re: [Tutor] Re Help with this script

2005-04-26 Thread Alan Gauld
> OK the situation is that I haven't still found out what the answer is, I > have noticed in the other hand that if I select the option "a" let's say 4 > times, I need to enter the option "f" 4 times. I am curious to know what the > solution is. I have read your chapter on recursion but that did no

[Tutor] font/text in pygame

2005-04-26 Thread D. Hartley
So with pygames, if I want to display text on the graphics window, I can set the font and size and so on, and set what I want my text to be. But if I wanted python to grab that text from a list, say, how would I do that? I can do it in the print command, as follows: for sc

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
On Apr 26, 2005, at 23:57, D. Hartley wrote: But in any case, font/text will only take strings - i cant pass in a list, or an index to an item in a list (which is, in this case, a tuple), and since the items in the list will be changed and updated obviously i cant just type in the items as strings

Re: [Tutor] Tkinter and Animation

2005-04-26 Thread jfouhy
Quoting Jeremiah Rushton <[EMAIL PROTECTED]>: > In a program that I'm writing in Tkinter, I wanted to know how to > animate objects. I have three buttons in the beginnig, all in the > center. I wanted to know how to, when the user clicks one of them, > make them small and move to a top corner and

Fwd: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
[Forwarding to the list. Please use "Reply to all", not "Reply", if you want your reply to a message to go to the list] Begin forwarded message: From: "D. Hartley" <[EMAIL PROTECTED]> Date: April 27, 2005 01:36:26 BST To: Max Noel <[EMAIL PROTECTED]> Subject: Re: [Tutor] font/text in pygame Reply

Re: [Tutor] font/text in pygame

2005-04-26 Thread Max Noel
On Apr 27, 2005, at 01:36, D. Hartley wrote: I haven't programmed in C (python is my first language!), but I *have* done something like this before, only with the print command: def displaybalance(): for score, name in mylist: slip = 30 - len(name) slip_amt = slip*" " pr

Re: [Tutor] font/text in pygame

2005-04-26 Thread D. Hartley
Max (et al.): I tried to do it that way ("score, name, posY" etc) and it told me "too many values to unpack". But I did get it to work the following way: # Display some text x, y = 230, 270 for score, name in mylist: slip = 30 - len(name) slip_amt = slip*

Re: [Tutor] font/text in pygame

2005-04-26 Thread D. Hartley
P.S. I should also add that the "print" commands embedded within the add_score function ARE displaying at the appropriate time (i.e., before I have to hit y/n). Of course they're in the text/console window, but it does tell me that it's executing that add_score function at the right point in time

Re: [Tutor] properties and subclasses

2005-04-26 Thread Brian van den Broek
Alan Gauld said unto the world upon 2005-04-26 17:01: I had found the first thread you linked. I see what you mean about the cure -- my general belief is that *I* am unlikely to have problems for which meta-classes are really the best solution :-) Once you get used to them meta-classes are very u

Re: [Tutor] properties and subclasses

2005-04-26 Thread Max Noel
On Apr 26, 2005, at 22:01, Alan Gauld wrote: I had found the first thread you linked. I see what you mean about the cure -- my general belief is that *I* am unlikely to have problems for which meta-classes are really the best solution :-) Once you get used to them meta-classes are very useful. In

Re: [Tutor] properties and subclasses

2005-04-26 Thread Kent Johnson
Max Noel wrote: Speaking of that, would you happen to know a good tutorial/introduction to metaclasses in Python? You could try Guido's essay: http://www.python.org/2.2/descrintro.html#metaclasses Kent ___ Tutor maillist - Tutor@python.org http://m