Re: [Tutor] win32gui, SetForegroundWindow() and setting focus

2008-03-16 Thread Alan Gauld
"Scott Nelson" <[EMAIL PROTECTED]> wrote > I'd like to programmatically set which window has the focus. But > win32gui.SetForegroundWindow(hwnd) seems to be what I'm looking for, > but, it isn't working quite as I expect meaning I probably have a > bad > assumption. Thats pretty common with wi

Re: [Tutor] noob python cgi

2008-03-16 Thread Tyler Smith
On 2008-03-16, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > Tyler Smith wrote: >> Hi, >> [snip explanation] >> Three files follow. First, the html index page, followed by the >> gallery picker, followed by the thumbnail displayer. >> >> Thanks! >> >> Tyler >> [snip code] >> > In the future ple

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread shawn bright
thanks all, appreciate it much. shawn On Sun, Mar 16, 2008 at 6:10 PM, Nathan McBride <[EMAIL PROTECTED]> wrote: > Yup I use the pexpect module for a lot however couldn't get 'pexpect.run' to > work with mysqldump piping to gzip > > > -Original Message- > From: Jeff Younker <[EMAIL PROT

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
Yup I use the pexpect module for a lot however couldn't get 'pexpect.run' to work with mysqldump piping to gzip -Original Message- From: Jeff Younker <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2008 6:59 PM To: Nathan McBride <[EMAIL PROTECTED]> Cc: tutor@python.org Subject: Re: [Tutor]

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Jeff Younker
> Would you mind perhaps show an example running an interactive > command like su and show how to send input to the commands waiting > propmts? If you're doing that then you *really* want to be using the pexpect module. cmd = pexpect.spawn('su - SOMEINTERACTIVECOMMAND') cmd.expect('# ') #

Re: [Tutor] login

2008-03-16 Thread linuxian iandsd
well, you first get to the authenticating page, that is where you put your username & pass ! & then you post them to be authenticated by server which then sends you a session id, which is a cookie. now to make the server think you're loged in to the site you have to send him back the cookie. now

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
Nathan McBride wrote: > Would you mind perhaps show an example running an interactive command like su > and show how to send input to the commands waiting propmts? Using the subprocess module, open a command and save the stdin and stdout pipes as variables. Then write to the stdin to send data t

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
linuxian iandsd wrote: > use os.popen("your cmd here") This is deprecated in 2.5+, you're supposed to use subprocess module now. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] win32gui, SetForegroundWindow() and setting focus

2008-03-16 Thread Tim Golden
Scott Nelson wrote: > Greetings all... > > I'm looking to use the win32api and win32gui modules to do a bit of > Windows tinkering (win2k) and I've hit a snag. > > I'd like to programmatically set which window has the focus. But > win32gui.SetForegroundWindow(hwnd) seems to be what I'm looking f

Re: [Tutor] login

2008-03-16 Thread Michael Langford
Perhaps try mechanize? http://wwwsearch.sourceforge.net/mechanize/ On Sat, Mar 15, 2008 at 12:57 PM, SwartMumba snake <[EMAIL PROTECTED]> wrote: > Using the cookie jar is not going to solve my problem. I don't want to use > the cookie jar. I just want to send the right request so that I will be s

Re: [Tutor] newbie needs help with rpg code in python

2008-03-16 Thread Michael Langford
IMO, in programming real applications, you should not hardcode most values. In programming games, you should often hardcode values, and sometimes not. (Games are not made to be reusable, and excessive softcoding makes changing them an exercise in config file tweaking). > > Of course, you shouldn't

Re: [Tutor] newbie needs help with rpg code in python

2008-03-16 Thread Michael Langford
If you'd like to damage_to_enemy from temp_e_hp, you do the following temp_e_hp -= damage_to_enemy or temp_e_hp = temp_e_hp- damage_to_enemy. Read the single equals sign as the word "gets" in your head. To get a random integer between two numbers, you do the folowing: import random random.ra

Re: [Tutor] newbie needs help with rpg code in python

2008-03-16 Thread Marc Tompkins
On Sun, Mar 16, 2008 at 10:59 AM, jake cooper <[EMAIL PROTECTED]> wrote: > print 'You inflicted', damage_to_enemy, "points of damage to your > enemy" #shows damage dealt > temp_e_hp - damage_to_enemy #!!!attempts to deduct damage_to_enemy > from temp_e_hp!!! > print temp_e_hp** > *

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
Would you mind perhaps show an example running an interactive command like su and show how to send input to the commands waiting propmts? -Original Message- From: linuxian iandsd <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2008 3:17 PM To: tutor@python.org Subject: Re: [Tutor] how to get

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Nathan McBride
Why don't you just use 'commands.getoutput'? -Original Message- From: linuxian iandsd <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2008 3:12 PM To: tutor@python.org Subject: Re: [Tutor] how to get response from os.system() use os.popen("your cmd here") On Sun, Mar 16, 2008 at 8:06 PM, Luk

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
i guess that was too short tutorial well, here is an example from a live session on the interpreter. [EMAIL PROTECTED] ~]# python Python 2.5.1 (r251:54863, Nov 23 2007, 16:16:53) [GCC 4.1.1 20070105 (Red Hat 4.1.1-51)] on linux2 Type "help", "copyright", "credits" or "license" for more information

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
use os.popen("your cmd here") On Sun, Mar 16, 2008 at 8:06 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > shawn bright wrote: > > Lo there all, > > > > I am needing to get a response back from a system command. > > i can do this: > > > > os.system('mailq | wc -l") > > > > if i do this in

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Luke Paireepinart
shawn bright wrote: > Lo there all, > > I am needing to get a response back from a system command. > i can do this: > > os.system('mailq | wc -l") > > if i do this in the terminal mailq | wc -l , it will spit out a number. > How do i get that number as a python variable ? You need to use t

[Tutor] win32gui, SetForegroundWindow() and setting focus

2008-03-16 Thread Scott Nelson
Greetings all... I'm looking to use the win32api and win32gui modules to do a bit of Windows tinkering (win2k) and I've hit a snag. I'd like to programmatically set which window has the focus. But win32gui.SetForegroundWindow(hwnd) seems to be what I'm looking for, but, it isn't working quite as

[Tutor] newbie needs help with rpg code in python

2008-03-16 Thread jake cooper
Hey everyone :) I'm extremely new to programming as python is the first language I have attempted to learn (and I only started yesterday!) I decided to start learning by attempting to create a short textbased rpg. My progress so far has been rather haphazard to say the least, but I think I might

Re: [Tutor] my first project: a multiplication trainer

2008-03-16 Thread Kent Johnson
tiger12506 wrote: > n = [1,2,5,1,2,34,2,4,7,3,3,45,1,76,8] > proxy = random.shuffle(xrange(len(n))) shuffle() shuffles in place, it doesn't return the shuffled list. > for idx in proxy: > dowith(n[idx]) Why not shuffle n directly? n = ... random.shuffle(n) for x in n: dowith(x) Kent _

[Tutor] how to get response from os.system()

2008-03-16 Thread shawn bright
Lo there all, I am needing to get a response back from a system command. i can do this: os.system('mailq | wc -l") if i do this in the terminal mailq | wc -l , it will spit out a number. How do i get that number as a python variable ? OK, thanks. shawn

Re: [Tutor] my first project: a multiplication trainer

2008-03-16 Thread Chris Fuller
Oops, I based those examples on my initial solution, not the preferred one that preserved the questions. Here is some better code. They only use the shuffle method, and I've elaborated a bit on the basic solution, to illustrate some ideas for improvement. Some things you might try as an exer

Re: [Tutor] my first project: a multiplication trainer

2008-03-16 Thread tiger12506
> choice() returns a random element from the list of choices, not its index. > One could call pop() instead of del, but del is probably a little faster, > and > doesn't return a value that we wouldn't use anyway. pop() wouldn't give > us a > random element, unless passed a random argument, such

Re: [Tutor] my first project: a multiplication trainer

2008-03-16 Thread Chris Fuller
On Sunday 16 March 2008 08:03, Guba wrote: > Hello! > > I like the idea of retaining my original questions by creating a proxy > list, but I wasn't able to understand (find) the proxy list: > > Chris Fuller wrote: > > from random import choice > > > > questions = [ [i,j] for i in range(1,10) for j

Re: [Tutor] [tutor] PyGame tutorials

2008-03-16 Thread Kent Johnson
Varsha Purohit wrote: > Hello all, > I have learnt python and wxPython. Now i want to learn making > games using pygame engine. Can anyone tellme from where i can learn > pygame and start making basic games using this module. Which version i > should download and is there any user group

Re: [Tutor] my first project: a multiplication trainer

2008-03-16 Thread Guba
Hello! I like the idea of retaining my original questions by creating a proxy list, but I wasn't able to understand (find) the proxy list: Chris Fuller wrote: > from random import choice > questions = [ [i,j] for i in range(1,10) for j in range(1,10) ] > false_answers = [] > > choices = range(

Re: [Tutor] Stupid Pythony Newbie Question: Basic Operators;

2008-03-16 Thread Gregor Lingl
Michael Lim schrieb: > Sorry guys, this is a newbie question... can someone please help me > with what the following 2 basic operators do in like simple english: > > 1. > > ^ This operator performs a logical operation, the exclusive or, also xor, for the binary digits af two integer numbers. The

Re: [Tutor] Stupid Pythony Newbie Question: Basic Operators;

2008-03-16 Thread Luke Paireepinart
Michael Lim wrote: > Sorry guys, this is a newbie question... can someone please help me with what > the following 2 basic operators do in like simple english: > Well, it depends on the situation you use the operation in. I'll give you some examples. > 1. > > ^ > This is a bitwise exclusive-

[Tutor] [TUTOR] Stupid Pythony Newbie Question: Basic Operators;

2008-03-16 Thread Michael Lim
Sorry guys, this is a newbie question... can someone please help me with what the following 2 basic operators do in like simple english: 1. ^ 2. % ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] What is the benefi of Embedding Python in my application ?

2008-03-16 Thread Meftah Tayeb
hi my friends, please : 1. What is the benefi of Embedding Python in my application ? 2. if python is embedded in my application: is require a Library to by redistributed ? Thanks ! -- Meftah Tayeb Software Developer, Database Administrator, Business Manager and

Re: [Tutor] Working with Python Objects

2008-03-16 Thread Alan Gauld
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote > I've combined your code fragments and added a function > call too, to determine how 'a' is passed between objects > and classes: - class A: def oneA(self): z = 2 self.a = self.a * z class B: def oneB