Re: [Tutor] Simulate Input from mouse and keyboard?

2006-03-15 Thread John Fouhy
On 16/03/06, Ars <[EMAIL PROTECTED]> wrote: > I'd like to be able have a program that can call up a webpage, click on a > text box and type into it as though a person was actually doing it. I don't know the general solution, but you might be able to solve this particular problem with PAMIE: http:/

Re: [Tutor] Help with Game over program

2006-03-15 Thread Ars
Python should have made the file associations when it was installed, but you can just manually associate *.py files with  C:\Python24\python.exe and then your program should run inside of a little DOS window.   -Jack On 3/15/06, Brad Hills <[EMAIL PROTECTED]> wrote: I'm 45 minutes into

[Tutor] Simulate Input from mouse and keyboard?

2006-03-15 Thread Ars
Is there a way to control the mouse cursor's position so I can tell it to move to X,Y position on the screen and click or double click automatically?   Also, how can you simulate input from the keyboard?   I'd like to be able have a program that can call up a webpage, click on a text box and

[Tutor] Matching against various login prompts

2006-03-15 Thread STREET Gideon (SPARQ)
Hi again, I'm trying to improve on couple of python scripts that I wrote and trying to get a successful/failed login re-usable module sorted out. Is there any way to match a returned string against a predetermined list of strings using the telnetlib module? I'm wanting to use a while loop rathe

Re: [Tutor] Dynamically naming functions

2006-03-15 Thread Alan Gauld
> > Very rarely, its easy to do backups of huge amounts of data if you > > know where to find it, its hard to trawl all over a changing structure > > looking for the things that need backing up. Particularly if, when you > > try to restore it, it needs to go in a different place to where you > > f

Re: [Tutor] Tix: binding

2006-03-15 Thread John Fouhy
On 16/03/06, Adam <[EMAIL PROTECTED]> wrote: > On 15/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I want to bind the cancel buttom of a ExFileSelectBox to a routine in my > > class, > Here's what I got from a little experimentation and print > box.cancel.bind.__doc__. > > >>> def bar(ac

Re: [Tutor] Help with Game over program

2006-03-15 Thread Anna Ravenscroft
On 3/15/06, Brad Hills <[EMAIL PROTECTED]> wrote: I'm 45 minutes into learning how to program using python. I am reading "Python programming for the absolute begginer" by  Michael Dawson, and the first thing I've done was write the "Game Over" program. Which I understand is also called the "Hello W

Re: [Tutor] Tix: binding

2006-03-15 Thread Adam
On 15/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am looking at Tix and I am stuck with what seems to be a simple problem: > > I want to bind the cancel buttom of a ExFileSelectBox to a routine in my > class, but can not make it work. > I guess the problem is the same for any binding o

[Tutor] Help with Game over program

2006-03-15 Thread Brad Hills
I'm 45 minutes into learning how to program using python. I am reading "Python programming for the absolute begginer" by  Michael Dawson, and the first thing I've done was write the "Game Over" program. Which I understand is also called the "Hello World" Program. My main problem at this point is wh

[Tutor] xemacs and python mode difficulty

2006-03-15 Thread Francesco Queirolo
Howdy,Relevant Data-Windows XP SP 2 or greaterPython 2.4.2 FinalXemacs 21.4.19--Problem:I really like xemacs as my editor of everything. However when I downloaded the inst

Re: [Tutor] Converting String to Datetime

2006-03-15 Thread Kent Johnson
Ed Singleton wrote: > I seem to have a lot of questions today. Sorry. > > How can I convert a string in the format "%Y-%m-%d %H:%M:%S" into a > datetime object? > > I can work out how to convert it to a time object by: > > import time > timestring = "2005-09-01 12:30:09" > time_format = "%Y-%m-

Re: [Tutor] Passing Dictionaries to Functions

2006-03-15 Thread Kent Johnson
Ed Singleton wrote: > Thanks again. > > This does bring up an issue I occaiosionally have with the documentation. > > Presumambly myfunc(**mydict) is a fairly trivial thing, but it is very > hard to find when you don't know what you're looking for. Not sure > what the solution is, but the inabil

Re: [Tutor] Converting String to Datetime

2006-03-15 Thread Ed Singleton
Nevermind. i seem to have found the answer in that wonderful PLEAC site (I always forget about that. It appears that the following works: import time, datetime timestring = "2005-09-01 12:30:09" time_format = "%Y-%m-%d %H:%M:%S" datetime.datetime.fromtimestamp(time.mktime(time.strptime(mytime, t

[Tutor] Converting String to Datetime

2006-03-15 Thread Ed Singleton
I seem to have a lot of questions today. Sorry. How can I convert a string in the format "%Y-%m-%d %H:%M:%S" into a datetime object? I can work out how to convert it to a time object by: import time timestring = "2005-09-01 12:30:09" time_format = "%Y-%m-%d %H:%M:%S" mytime = time.strptime(time

Re: [Tutor] Passing Dictionaries to Functions

2006-03-15 Thread Ed Singleton
Thanks again. This does bring up an issue I occaiosionally have with the documentation. Presumambly myfunc(**mydict) is a fairly trivial thing, but it is very hard to find when you don't know what you're looking for. Not sure what the solution is, but the inability to search for things when you

Re: [Tutor] Passing Dictionaries to Functions

2006-03-15 Thread Kent Johnson
Ed Singleton wrote: > If I have a dictionary: > > mydict{'var1':"a", 'var2':"b"} Presumably you mean mydict = {'var1':"a", 'var2':"b"} > > and I want to pass it to a function as: > > myfunc(var1="a", var2="b") > > How would I do it? myfunc(**mydict) Kent _

Re: [Tutor] "Unexcepted Python Error : Exceptions.IOError: [Errorno 9] Bad File descriptor"

2006-03-15 Thread Kent Johnson
K.Vijaya Balaji Chellamani wrote: > Respected Sir , > I am new and introducing myself as Vijaya Balaji > Chellmani . When i was using the python for my office application ( uses > VC++ ) unfortunately i was awarded with unexcepted python error .The > error is > "Unexcepte

[Tutor] Passing Dictionaries to Functions

2006-03-15 Thread Ed Singleton
If I have a dictionary: mydict{'var1':"a", 'var2':"b"} and I want to pass it to a function as: myfunc(var1="a", var2="b") How would I do it? Thanks Ed ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] "Unexcepted Python Error : Exceptions.IOError: [Errorno 9] Bad File descriptor"

2006-03-15 Thread K.Vijaya Balaji Chellamani
Respected Sir ,     I am new and introducing myself as Vijaya Balaji Chellmani . When i was using the python for my office application ( uses VC++ ) unfortunately i was awarded with unexcepted python error .The error is "Unexcepted Python Error : Exceptions.IOError: [Errorno

Re: [Tutor] OSError

2006-03-15 Thread Kent Johnson
Christopher Spears wrote: > I am trying to write a function that takes a directory > name and describes the contents of the directory (file > name and size) recursively. Here is what I have > written so far: > > import os, os.path > > def describeDirectory(directory): > if os.listdir(directo

Re: [Tutor] Help me please

2006-03-15 Thread Kent Johnson
yogeshwarran Nadeson wrote: > Hello, > > I am a newbie in python programming without previous programming > experience.Here i would like to ask > a question based on the exercises given by Josh Cogliatti in his > tutorial.I'll paste the question.Hope you can help me to solve it.I'd > like to en

Re: [Tutor] Splitting a string into n-sized bytes

2006-03-15 Thread Kent Johnson
Steve Nelson wrote: > Indeed - as I now have a function: > > def nsplit(s, n): > return [s[i:i+n] for i in range(0, len(s), n)] > > Incidentally I am currently going with: > > def nsplit(s, n): > while s: >yield s[:n] >s = s[n:] You can write the generator function to use the same m

Re: [Tutor] OSError

2006-03-15 Thread Ewald Ertl
Hi Chris, I think I've found the problem. os.listdir() gives you all entries of the directory, but your not changing to that directory. The os.path.getsize() just does not find the file in the directory "testFiles" under your current directory. See my short example below. >>> import o