[Tutor] tuple/list assignment in 'for-in'

2005-04-27 Thread brian will
Hi there, I can't explain my experience with what I like to call 'parallel assignment' (tuple/list assignment) inside 'for-in' loops and list comprehensions: 1) [f + g for f, g in (1, 2), (3, 4)] [3, 7] 2) x = 'ab' y = 'cd' [f + g for f, g in x, y] ['ab', 'cd'] 3) f, g = '123', '456' f

Re: [Tutor] properties and subclasses

2005-04-27 Thread Alan Gauld
Once you get used to them meta-classes are very useful. In fact I have never built an industrial size OO system yet that did not use meta classes somewhere in the design... Speaking of that, would you happen to know a good tutorial/introduction to metaclasses in Python? Nope, but it

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

2005-04-27 Thread Alan Gauld
I'm not sure but from the docs it sounds like os.wait() would be called once for each child also, as If you don't specify a pid os.wait should return as soon as *any* child process terminates. Which is why it returns the pid - to tell you which child died... At least that's what I'd expect

[Tutor] Re: tuple/list assignment in 'for-in'

2005-04-27 Thread Brian Beck
brian will wrote: Hi there, I can't explain my experience with what I like to call 'parallel assignment' (tuple/list assignment) inside 'for-in' loops and list comprehensions: You're probably confused about what's being assigned to what inside the comprehension. Maybe this will clear it up:

[Tutor] Re: tuple/list assignment in 'for-in'

2005-04-27 Thread brian will
Thanks. I realized this mistake right before you replied. Yup, the coincidence of my test cases threw me there. By the way, what's a good way to reply to specific subjects and quoting when using the mailing list through g-mail here? ___ Tutor maillist

[Tutor] Re: Tkinter and Animation

2005-04-27 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. Do

Re: [Tutor] Re: Tkinter and Animation

2005-04-27 Thread Michael Lange
On Wed, 27 Apr 2005 09:35:47 -0700 Jeremiah Rushton [EMAIL PROTECTED] wrote: I wanted them to visually shrink and visually move to a corner on the frame. I did not know how to do it the way you explained, thanks for that. But is there any way to do it visually? I guess so, if you use

[Tutor] Is it possible to load variable into a regex string?

2005-04-27 Thread Tom Tucker
Hello all! I am trying to pass a variable to my re.compile string (see broken example below). Is something like this possible? Thanks! regexstring = 'H\sb' textstring = 'BLAH blah' match = re.compile((%s) % (regexstring)) # ? if match.search(line): print I found it! Tom

Re: [Tutor] Is it possible to load variable into a regex string?

2005-04-27 Thread Danny Yoo
On Wed, 27 Apr 2005, Tom Tucker wrote: Hello all! I am trying to pass a variable to my re.compile string (see broken example below). Is something like this possible? Thanks! regexstring = 'H\sb' textstring = 'BLAH blah' match = re.compile((%s) % (regexstring)) # ? Hi Tom, Ah, I think

[Tutor] Is there an InputBox function in pygame/python?

2005-04-27 Thread D. Hartley
I am trying to create a box on the graphics window which asks a user for their name. My research led me to the InputBox function, which is said to get user input, allowing backspace etc shown in a box in the middle of the screen (but ignores the shift key?). I found several pages that refer to

[Tutor] Help with daemon

2005-04-27 Thread Alberto Troiano
Hi everyone Again disturbing the peace of the TUTOR :D I'm making an application to check every few seconds for photos uploaded via ftp The users will program their upload time via web page (made in php). The time is saved in a MySQL database so I will check for all the created users if they

Re: [Tutor] Help with daemon

2005-04-27 Thread Max Noel
On Apr 27, 2005, at 22:35, Alberto Troiano wrote: I'm gonna give you an example: The program will check for new users and to check record time every 10 seconds. But first the program will have to finish the checking process that started before so it won't be 10 seconds right? Unless I have one

Re: [Tutor] crash - switching between text window andgraphics/gamewindow (high score)

2005-04-27 Thread Jacob S.
I haven't been following this thread, so apologies in advance if this is something you've already done --- Have you tried running the program from a command prompt? To do this, go to Start--Run and type 'cmd'. Then change to the directory with your script in it ('cd ' followed by the full

Re: [Tutor] font/text in pygame

2005-04-27 Thread Jacob S.
def displaybalance(): for score, name in mylist: slip = 30 - len(name) slip_amt = slip* print %s%s%s % (name,slip_amt,score) (I did this with the print command to make sure it would produce what I wanted, three strings for the three sample scores I put in this dummy

Re: [Tutor] font/text in pygame

2005-04-27 Thread D. Hartley
Jacob (et al): Unfortunately at this point I'm rendering the text, not printing it (using text = font.render). So I need to know if there is a hard character or something I can type, since 50* (space) isnt lining them up right. Thanks! ~Denise On 4/27/05, Jacob S. [EMAIL PROTECTED] wrote:

Re: [Tutor] Re Help with this script

2005-04-27 Thread John Carmona
OK Alan, I thing I have seen the light!!. Here is the script that Kent and you asked me to look at modified: - def print_options(): print -- print Options: print a. print options

[Tutor] Re: Re: Re: Tkinter and Animation

2005-04-27 Thread Jeremiah Rushton
I wanted them to visually shrink and visually move to a corner on the frame. I did not know how to do it the way you explained, thanks for that. But is there any way to do it visually? I guess so, if you use the place geometry manager. With place() you can determine things like x- and

Re: [Tutor] Re Help with this script

2005-04-27 Thread jfouhy
Quoting John Carmona [EMAIL PROTECTED]: Is it that if you use while 1: you create a recursive function? Hope I am right. No ... Remember how functions can call other functions? def add(x, y): Add two integers together. return x+y def mul(x, y): Multiply two integers together.

Re: [Tutor] Re: Re: Re: Tkinter and Animation

2005-04-27 Thread jfouhy
Quoting Jeremiah Rushton [EMAIL PROTECTED]: from Tkinter import * from time import sleep class Main: def __init__(self,master): button = Button(master,text='button') button.place(x=1,y=1) y=3 for x in range(1,25): sleep(.3) button.place_forget()