Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-02 Thread Chris Hengge
Nevermind, I just realised my problem with the script I just sent. I'm using a laptop right now and the print screen key is FN+ Insert FN isn't mappable. Works fine on an external keyboard, so I guess I'll try one of the other recommendations. Thanks alot for the time guys. On 11/2/06, Chris H

Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-02 Thread Chris Hengge
I'm not sure where I got this from, but I think its from your site.. import msvcrtdef doKeyEvent(key):    if key == '\x00' or key == '\xe0': # non ASCII   key = msvcrt.getch() # fetch second character     print ord(key)def doQuitEvent(key):    raise SystemExit# First, clear the screen of clutte

Re: [Tutor] Syntax Error? Variable Scope?

2006-11-02 Thread Dustin J. Mitchell
Chuck Coker wrote: > from net.grinder.script import Test > from net.grinder.script.Grinder import grinder > from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest > from HTTPClient import NVPair > connectionDefaults = HTTPPluginControl.getConnectionDefaults() > httpUtilities = HTTPPlugi

Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-02 Thread Luke Paireepinart
Chris Hengge wrote: > I've got your code at home, and I know it picks up shift and ctrl > modified items, but it wont register print screen (among a few > others). I can post the code I have at home later if you want to > verify it. I've been given a few methods to try in my other thread I > ju

Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-02 Thread Chris Hengge
I've got your code at home, and I know it picks up shift and ctrl modified items, but it wont register print screen (among a few others). I can post the code I have at home later if you want to verify it. I've been given a few methods to try in my other thread I just started on here which are more

[Tutor] Syntax Error? Variable Scope?

2006-11-02 Thread Chuck Coker
Hi Folks, I am new to Python, but I have many years experience in software development. I have a question about variable scope. I'm having a problem that I suspect is merely a syntax error or something of that nature. I'm not real clear on variable scoping rules, either. I can't figure out how to

Re: [Tutor] Print Screen

2006-11-02 Thread Luke Paireepinart
>> Anyone know of a way to capture special keys like "Print Screen"? >> I have a small script to grab all they keycodes, but it doesn't seem to >> catch several keys on the keyboard. I've got a utility that I'd like to >> be able to automagically get a screenshot when something goes wrong so I

Re: [Tutor] One million and counting

2006-11-02 Thread Daniel McQuay
I second Jorge, I also learned from your site. well done,On 10/31/06, Glenn T Norton <[EMAIL PROTECTED] > wrote:Alan Gauld wrote:>Hi folks,>>In just thought I'd mention that my web tutor has now passed >the million visitors mark. Thanks to all those on the tutor>list who have paid a visit.>>Alan Ga

Re: [Tutor] Print Screen

2006-11-02 Thread Bill Burns
Chris Hengge wrote: > I posted this in a similar thread a few days ago, and no replies so I > think it needs its own listing. > > Anyone know of a way to capture special keys like "Print Screen"? > I have a small script to grab all they keycodes, but it doesn't seem to > catch several keys on th

[Tutor] setlocale on windows

2006-11-02 Thread frank h.
Hello all,I wrote a script on UNIX that uses the following statements:import locale, datetimelocale.setlocale(locale.LC_ALL, 'sv_Se')with that, I can get localized dates like this> datetime.datetime.today ().strftime('%A')'Fredag'problem is, this doesnt work on windows!I get:locale.Error: unsupport

Re: [Tutor] How to capture 'Ctrl+c' in Python

2006-11-02 Thread Alan Gauld
"Chris Hengge" <[EMAIL PROTECTED]> wrote > Do you by chance know of a way to capture special keys like "Print > Screen"? Try the key capture code in my Event Driven topic. So far as I know it works for all keys including the special ones. It also points out that those keys have a two part code.

Re: [Tutor] Using sys.exit()

2006-11-02 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote >>You can use an argument if you want to pass an error value >>back to the OS. This is good practice if your script might be >>used in a batch file or shell script > > So what should that value be? Zero means no errors and is the default value. But you can

Re: [Tutor] Print Screen

2006-11-02 Thread Terry Carroll
On Thu, 2 Nov 2006, Luke Paireepinart wrote: > >>> import ImageGrab > >>> ImageGrab.grab().save('temp.jpg') I never knew about that. Thanks, that's pretty cool. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Print Screen

2006-11-02 Thread Luke Paireepinart
Chris Hengge wrote: > Awesome! Thanks again Luke > > How do I capture the keycode for print screen? (now I'm just curious, > because like I said, I've got a script that grabs all but maybe half a > dozen keys) Well, how are you doing it now? That's the important part. > > On 11/2/06, *Luke Pairee

Re: [Tutor] Print Screen

2006-11-02 Thread Luke Paireepinart
Chris Hengge wrote: > Because I dont know any other way to capture the screen? (In my mind > using print screen would be universal) =P The print screen button doesn't do anything. It generates a keycode just like any other button on the keyboard. Windows captures this keypress and interprets it as

Re: [Tutor] Print Screen

2006-11-02 Thread Chris Hengge
Because I dont know any other way to capture the screen? (In my mind using print screen would be universal) =POn 11/2/06, Luke Paireepinart < [EMAIL PROTECTED]> wrote:Chris Hengge wrote:> I posted this in a similar thread a few days ago, and no replies so I > think it needs its own listing.>> Anyon

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 12:35 PM 11/2/2006, Kent Johnson wrote: >Dick Moores wrote: >>At 11:33 AM 11/2/2006, Markus Rosenstihl wrote: >>>Try somthing like this: >>> >>>In [32]: a=range(100) >>>In [33]: for i in range(0,len(a)): >>> : print '%-27s'%a[i], >>> : if (i+1)%3 == 0: print "\n" >>> >>>0

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Kent Johnson
Dick Moores wrote: > At 11:33 AM 11/2/2006, Markus Rosenstihl wrote: >> Try somthing like this: >> >> In [32]: a=range(100) >> In [33]: for i in range(0,len(a)): >> : print '%-27s'%a[i], >> : if (i+1)%3 == 0: print "\n" >> >> 0 1

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 11:51 AM 11/2/2006, Kent Johnson wrote: >Dick Moores wrote: >>Oops! Got overconfident. Didn't check to see if it actually printed >>the whole list. It didn't. Left off "rad: radian", because there >>are 46 items in the list (46%3 is 1, not 0). So now the only way I >>could see to print all 46

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 11:33 AM 11/2/2006, Markus Rosenstihl wrote: >Try somthing like this: > >In [32]: a=range(100) >In [33]: for i in range(0,len(a)): > : print '%-27s'%a[i], > : if (i+1)%3 == 0: print "\n" > >0 1 2 > >3

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Kent Johnson
Dick Moores wrote: > Oops! Got overconfident. Didn't check to see if it actually printed > the whole list. It didn't. Left off "rad: radian", because there are > 46 items in the list (46%3 is 1, not 0). So now the only way I could > see to print all 46 was to add 2 empty dummies to make 48, whic

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Markus Rosenstihl
Am 02.11.2006 um 15:14 schrieb Dick Moores: > At 03:31 AM 11/2/2006, you wrote: >> At 03:13 AM 11/2/2006, Kent Johnson wrote: >>> Luke Paireepinart wrote: Instead of helping you with your specific problem, I'll give you this information and see what you can make of it. >

[Tutor] Print Screen

2006-11-02 Thread Chris Hengge
I posted this in a similar thread a few days ago, and no replies so I think it needs its own listing. Anyone know of a way to capture special keys like "Print Screen"?I have a small script to grab all they keycodes, but it doesn't seem to catch several keys on the keyboard. I've got a utility that

Re: [Tutor] Print Screen

2006-11-02 Thread Luke Paireepinart
Chris Hengge wrote: > I posted this in a similar thread a few days ago, and no replies so I > think it needs its own listing. > > Anyone know of a way to capture special keys like "Print Screen"? > I have a small script to grab all they keycodes, but it doesn't seem > to catch several keys on the

Re: [Tutor] Performing arithmetic operations with date

2006-11-02 Thread Christopher Arndt
Asrarahmed Kadri schrieb: > I want to perform arithmetic operations on date supplied by the user on the > command line. > > Is there any built-in utility for this..?? Not built-in, but very useful: http://labix.org/python-dateutil Chris ___ Tutor mail

Re: [Tutor] str.strip() help

2006-11-02 Thread Christopher Arndt
John Fouhy schrieb: > On 02/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > myStr = "I want to strip my words." > print myStr.strip("my") > 'I want to strip words.' > > .strip() only removes text from the beginning and end of the string. It is generally used to remove whitespace from

Re: [Tutor] Performing arithmetic operations with date

2006-11-02 Thread Luke Paireepinart
Asrarahmed Kadri wrote: [question about dates and times] Asrarahmed, please check google.com and other resources before asking on the list. A google of 'python date module' brought the page http://pleac.sourceforge.net/pleac_python/datesandtimes.html as the first link, which has examples on usage

[Tutor] Performing arithmetic operations with date

2006-11-02 Thread Asrarahmed Kadri
  Hello Guys...   I want to perform arithmetic operations on date supplied by the user on the command line.   Is there any built-in utility for this..??   TIA.   Regards, Asrarahmed       -- To HIM you shall return. ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 03:31 AM 11/2/2006, you wrote: >At 03:13 AM 11/2/2006, Kent Johnson wrote: > >Luke Paireepinart wrote: > > > Instead of helping you with your specific problem, I'll give you this > > > information and see what you can make of it. > > > > > > >>> print 'a'.ljust(20)+'b'.ljust(20) > > > a

Re: [Tutor] Cal command in python...

2006-11-02 Thread Simon Brunning
On 11/2/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > In the Python standard library. Much of the library is written in Python > and supplied as source. On Windows it will be something like > C:\Python25\Lib\calendar.py. On other platforms I don't know the path > but it will be part of the Python i

Re: [Tutor] Cal command in python...

2006-11-02 Thread Kent Johnson
Asrarahmed Kadri wrote: > > I got the command and saw its output..? But where to look for the source > code..? > Which library ? In the Python standard library. Much of the library is written in Python and supplied as source. On Windows it will be something like C:\Python25\Lib\calendar.py. O

Re: [Tutor] Cal command in python...

2006-11-02 Thread Asrarahmed Kadri
  I got the command and saw its output..? But where to look for the source code..? Which library ?   TIA.   Regards, Asrarahmed     On 11/2/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Asrarahmed Kadri wrote:>>> Folks,>> Does anybody have an idea of the logic used in cal command... I want to > know

Re: [Tutor] Cal command in python...

2006-11-02 Thread Kent Johnson
Asrarahmed Kadri wrote: > > > Folks, > > Does anybody have an idea of the logic used in cal command... I want to > know the algorithm so that I can implement in Python. See the calendar module. Source code in the library if you want to see how it is done. In [1]: import calendar In [2]: c

[Tutor] Cal command in python...

2006-11-02 Thread Asrarahmed Kadri
  Folks,   Does anybody have an idea of the logic used in cal command... I want to know the algorithm so that I can implement in Python.   A pseudo code might be helpful...   TIA.   Regards, ~Asrarahmed~ -- To HIM you shall return. ___ Tutor maillist -

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 03:13 AM 11/2/2006, Kent Johnson wrote: >Luke Paireepinart wrote: > > Instead of helping you with your specific problem, I'll give you this > > information and see what you can make of it. > > > > >>> print 'a'.ljust(20)+'b'.ljust(20) > > a b > > >>> print 'carrah'.ljust(20)+

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Kent Johnson
Luke Paireepinart wrote: > Instead of helping you with your specific problem, I'll give you this > information and see what you can make of it. > > >>> print 'a'.ljust(20)+'b'.ljust(20) > a b > >>> print 'carrah'.ljust(20)+'foobar'.ljust(20) > carrah

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
At 01:45 AM 11/2/2006, Luke Paireepinart wrote: >Instead of helping you with your specific problem, I'll give you this >information and see what you can make of it. > > >>> print 'a'.ljust(20)+'b'.ljust(20) >a b > >>> print 'carrah'.ljust(20)+'foobar'.ljust(20) >carrah

Re: [Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Luke Paireepinart
Instead of helping you with your specific problem, I'll give you this information and see what you can make of it. >>> print 'a'.ljust(20)+'b'.ljust(20) a b >>> print 'carrah'.ljust(20)+'foobar'.ljust(20) carrah foobar Notice how t

Re: [Tutor] Using sys.exit()

2006-11-02 Thread Andreas Kostyrka
Am Mittwoch, den 01.11.2006, 22:16 -0800 schrieb Dick Moores: > At 03:56 PM 11/1/2006, Andreas Kostyrka wrote: > >Am Mittwoch, den 01.11.2006, 15:43 -0800 schrieb Dick Moores: > > > At 12:14 AM 10/31/2006, Alan Gauld wrote: > > > > > > >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > > > I'd like to

[Tutor] Need to be taught a trick or two about printing in neat columns

2006-11-02 Thread Dick Moores
I'm working on a program named unitConversion.py. In it, I give the user a chance to see a list of all the measurement units the program handles, and their abbreviations. The user needs the abbreviations to do the conversions. So I have a couple of functions (see below) that together will print

Re: [Tutor] Using sys.exit()

2006-11-02 Thread Luke Paireepinart
> > Yes, I realize that. But what if I'm not doing anything after the > loop? In that case is there anything wrong with using break to end the > script? I'm getting the idea from the responses that there IS > something wrong, but I don't see what it is. Generally, something that exits with a br

Re: [Tutor] Using sys.exit()

2006-11-02 Thread Dick Moores
At 11:09 PM 11/1/2006, Luke Paireepinart wrote: >>If I can manage to use "break", all 3 exits are silent. Why is it >>wrong to use "break" to exit? >> >'break' doesn't exit. It ends a loop. >It's not wrong to use a 'break' to exit a loop. That's what it's there for. >But what if you were doing s