Re: [Tutor] Disable keyboard/mouse input on windows?

2007-10-01 Thread Tim Golden
Trey Keown wrote: > Hey everybody, > I was wondering, how could I disable all keyboard/mouse input for the > whole windows system while I have a video playing? So the user can't > press, for example, the super key [one with windows logo on it], and have > the windows menu pop up? > Could this be ac

Re: [Tutor] How to Practice Python?(Linpeiheng)

2007-10-01 Thread Alan Gauld
"???" <[EMAIL PROTECTED]> wrote > I am learning Python. Do you know somewhere I can practice Python? > I means some sites where have exercises I can try solving. The Useless Python website has some exercises and other small projects. Some have solutions some don't. Also the Python Challenge we

Re: [Tutor] Really basic web templating

2007-10-01 Thread Alan Gauld
"wormwood_3" <[EMAIL PROTECTED]> wrote > ...nearly every tutorial I have seen regarding Python and CGI only > have to do with form submissions, Thats the most common use of CGI but really a form submission is just a standard HTTP GET/POST request with some predefined variables. In reality the us

Re: [Tutor] Disable keyboard/mouse input on windows?

2007-10-01 Thread Alan Gauld
"Trey Keown" <[EMAIL PROTECTED]> wrote > I was wondering, how could I disable all keyboard/mouse input for > the > whole windows system while I have a video playing? So the user can't > press, for example, the super key [one with windows logo on it], and > have > the windows menu pop up? > Coul

Re: [Tutor] [tutor] creating image from a given data in wxpython

2007-10-01 Thread Alan Gauld
"Ian Witham" <[EMAIL PROTECTED]> wrote >> I basically wanna create a bitmap image in python. This will be >> basically in pixels. X and y coordinates will be specified in the >> program >> and python should create an image by matching the colours. > I found it to be a very slow way to do th

Re: [Tutor] [tutor] printing bitmap image dynamically reading data inwxpython

2007-10-01 Thread Alan Gauld
"Varsha Purohit" <[EMAIL PROTECTED]> wrote > I want to create a wxpython program where i am reading a list > having > integer values like [1,2,3,4]. and i need to display the output > value as > bitmap image which shd be coloured after reading the values. Like > 1=red, > 2=yellow, 3=orange

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread Alan Gauld
"GTXY20" <[EMAIL PROTECTED]> wrote > Any way to display the count of the values in a dictionary where the > values > are stored as a list? here is my dictionary: > > {'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], > '4': > ['a', 'c']} > > I would like to display count as foll

Re: [Tutor] Really basic web templating

2007-10-01 Thread Martin Walsh
wormwood_3 wrote: > Well yes and no:-) This sort of application would fall under the > sprawling category of CGI, yes, and I can use Python scripts on my web > server, so it is supported. But nearly every tutorial I have seen > regarding Python and CGI only have to do with form submissions, doing >

Re: [Tutor] creating the equivalent of string.strip()

2007-10-01 Thread Andrew James
I've gone ahead and created a script that does this, however it also strips punctuation. I was originally just comparing each character to a string containing a single space ' ' but even using s[-1].isspace() I lose punctuation marks. Any idea why that's happening? (Not the OP, I just thought t

Re: [Tutor] Really basic web templating

2007-10-01 Thread Kent Johnson
wormwood_3 wrote: > I want > to do this because my site is on a shared hosting account, so I cannot > install a web framework like Django Another option is to switch to a hosting account that supports Python. I have been working with WebFaction and I'm very happy with them; an account with Djan

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread Kent Johnson
GTXY20 wrote: > Hello, > > Any way to display the count of the values in a dictionary where the > values are stored as a list? here is my dictionary: > > {'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], '4': > ['a', 'c']} > > I would like to display count as follows and I wou

Re: [Tutor] creating the equivalent of string.strip()

2007-10-01 Thread Alan Gauld
"Andrew James" <[EMAIL PROTECTED]> wrote > string containing a single space ' ' but even using s[-1].isspace() > I > lose punctuation marks. Any idea why that's happening? care to show us what you are doing? >>> ';'.isspace() False So puntuation should not show up as true... Alan G. __

Re: [Tutor] creating the equivalent of string.strip()

2007-10-01 Thread Kent Johnson
Andrew James wrote: > I've gone ahead and created a script that does this, however it also > strips punctuation. I was originally just comparing each character to a > string containing a single space ' ' but even using s[-1].isspace() I > lose punctuation marks. Any idea why that's happening? H

Re: [Tutor] Really basic web templating

2007-10-01 Thread wormwood_3
My host actually does support Python. But I don't have access to Apache rules nor the level of access to install apps like Django, so I am limited to just scripts I write. But for that price, i will definitely check out WebFaction! -Sam - Original Message From: Kent Johnson <[EMAIL PR

Re: [Tutor] Really basic web templating

2007-10-01 Thread Kent Johnson
wormwood_3 wrote: > My host actually does support Python. But I don't have access to > Apache rules nor the level of access to install apps like Django, so > I am limited to just scripts I write. Webfaction gives you both - you can install anything you like as long as it doesn't require superuser

[Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread János Juhász
Dear Tutors, I would like to make a new class instance, where the intance attributes coming from the kwargs hash. class ADUser: def __init__(self, **kwargs): for key in kwargs.keys(): self.key = kwargs[k] a = ADUser(name='papa') It isn't working :( Yours sincerely, _

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Kent Johnson
János Juhász wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key = kwargs[k] This sets the 'key' attribute

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Dave Kuhlman
On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Tim Golden
Dave Kuhlman wrote: > On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: >> Dear Tutors, >> >> I would like to make a new class instance, where >> the intance attributes coming from the kwargs hash. >> >> class ADUser: >> def __init__(self, **kwargs): >> for key in kwargs.key

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Kent Johnson
Dave Kuhlman wrote: > On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: >> Dear Tutors, >> >> I would like to make a new class instance, where >> the intance attributes coming from the kwargs hash. >> >> class ADUser: >> def __init__(self, **kwargs): >> for key in kwargs.key

[Tutor] Location of modules in Mac OS X

2007-10-01 Thread Roy Chen
Hello all, I'm using MacPython 2.5 on OS X 10.4. I was just wondering if all the Python modules are contained in this directory: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ Also, I've installed the Python Image Library (PIL), and it seems to be installed in this folder:

Re: [Tutor] How to Practice Python?(Linpeiheng)

2007-10-01 Thread Andy
While not Python specific you could to the Ruby quizzes (http://www.rubyquiz.com/). Just look at the problems and write a solution in Python. On 10/1/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "???" <[EMAIL PROTECTED]> wrote > > > I am learning Python. Do you know somewhere I can practice Pyth

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread GTXY20
This works perfectly. However I will be dealing with an import of a very large dictionary - if I call the commands at command line this seems to be very taxing on the CPU and memory and will take a long time. I was thinking of creating each as a fucntion whereby python would just to write to a fi

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread Kent Johnson
GTXY20 wrote: > > This works perfectly. > > However I will be dealing with an import of a very large dictionary - if > I call the commands at command line this seems to be very taxing on the > CPU and memory and will take a long time. > > I was thinking of creating each as a fucntion whereb

[Tutor] function for removing all white spaces from a string

2007-10-01 Thread Tim
Hello, after reading the responses to athread in 2004 [1] I am wondering why there is no easy function in python to remove all white spaces from a string. Like: " i am very fine " to "iamveryfine" In IDL there's just one simple function which does this: STRCOMPRESS [2]. Is there really not yet

Re: [Tutor] [tutor] printing bitmap image dynamically reading data inwxpython

2007-10-01 Thread Varsha Purohit
Hi Alan, Thanks for the response. Its not a home work problem its actually a task i need to complete as i am tryin to make some tool which will be helpful to use as a script in arcgis. i kinda got some clue will surely ask help if i get stuck somewhere coz i know its difficult to put down in wor

Re: [Tutor] Location of modules in Mac OS X

2007-10-01 Thread Alan Gauld
"Roy Chen" <[EMAIL PROTECTED]> wrote > I'm using MacPython 2.5 on OS X 10.4. > > I was just wondering if all the Python modules are contained in this > directory: > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ The standard library modules are. Any custom moidules could be alm

Re: [Tutor] function for removing all white spaces from a string

2007-10-01 Thread Alan Gauld
"Tim" <[EMAIL PROTECTED]> wrote > after reading the responses to athread in 2004 [1] I am wondering > why there is > no easy function in python to remove all white spaces from a string. > > " i am very fine " > to > "iamveryfine" You can use string.replace. >>> 'I am very fine'.replace(' ','')

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Alan Gauld
"János Juhász" <[EMAIL PROTECTED]> wrote > class ADUser: >def __init__(self, **kwargs): >for key in kwargs.keys(): >self.key = kwargs[k] > > a = ADUser(name='papa') > > > It isn't working :( Try using setattr instead of self.key assignment. HTH, -- Alan Gauld Author o

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Noufal Ibrahim
János Juhász wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key = kwargs[k] > > a = ADUser(name='papa') >

Re: [Tutor] Location of modules in Mac OS X

2007-10-01 Thread Kent Johnson
Roy Chen wrote: > Hello all, > > I'm using MacPython 2.5 on OS X 10.4. > > I was just wondering if all the Python modules are contained in this > directory: > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ Try import sys sys.path That will give you a list of all the places

Re: [Tutor] Really basic web templating

2007-10-01 Thread wormwood_3
There was another host that I wanted to mention along these lines (for Python sites) that I think is even better: VPSLink (http://www.vpslink.com). They allow root SSH access, and can install your choice of OS (lots of linux flavors, ubuntu, SUSE, CentOS, etc) from a control panel. Aside from th

Re: [Tutor] Really basic web templating

2007-10-01 Thread Michael Langford
Check to see if mod_python is installed/installable. It would quite easily give you a very simple interface to do what you're looking for. --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 9/30/07, wormwood_3 <[EMAIL PROTECTED]> wrote: > Hell

Re: [Tutor] How to Practice Python?(Linpeiheng)

2007-10-01 Thread Rolando Pereira
Alan Gauld wrote: > There are no such things > as standard solutions to programming problems, its not like > doing math! But usually there is "The Right Way". I think... -- _ ASCII ribbon campaign ( ) - against HTML email X & vCards / \

Re: [Tutor] function for removing all white spaces from a string

2007-10-01 Thread Bill Campbell
On Mon, Oct 01, 2007, Alan Gauld wrote: > >"Tim" <[EMAIL PROTECTED]> wrote > >> after reading the responses to athread in 2004 [1] I am wondering >> why there is >> no easy function in python to remove all white spaces from a string. >> >> " i am very fine " >> to >> "iamveryfine" > >You can use s

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread Ricardo Aráoz
GTXY20 wrote: > Hello, > > Any way to display the count of the values in a dictionary where the > values are stored as a list? here is my dictionary: > > {'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], '4': > ['a', 'c']} > > I would like to display count as follows and I would

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread GTXY20
Thanks again I have worked that issue out. However I have the following function and it is throwing this error: FEXpython_v2.py", line 32, in UnitHolderDistributionqty count[item]+=1 KeyError: 3 This is the function: def Distributionqty(dictionary): holder=list() held=list() dis

Re: [Tutor] function for removing all white spaces from a string

2007-10-01 Thread Ricardo Aráoz
Tim wrote: > Hello, > after reading the responses to athread in 2004 [1] I am wondering why there is > no easy function in python to remove all white spaces from a string. > > Like: > > " i am very fine " > to > "iamveryfine" > > In IDL there's just one simple function which does this: STRCOMPRE

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread Kent Johnson
GTXY20 wrote: > > Thanks again I have worked that issue out. > > However I have the following function and it is throwing this error: > > FEXpython_v2.py", line 32, in UnitHolderDistributionqty > count[item]+=1 > KeyError: 3 > > This is the function: > > def Distributionqty(dictionary

Re: [Tutor] Dictionary - count values where values are stored as a list

2007-10-01 Thread GTXY20
Thanks so much I changed to the following and this worked: def HolderDistributionqty(dictionary): from collections import defaultdict count=defaultdict(int) for item in dictionary.values(): count[len(item)]+=1 for k,v in sorted(count.items()): fdist=k qty=v

[Tutor] A simple Question...

2007-10-01 Thread Suzanne Peel
Hi, I have a very simple question that I cannot find the answer to ... if I knew the correct question to ask it would be simple. I am trying to find the name of the file I am currently running (please don't laugh at me I know it's simple but I cannot figure it out). I want to know where my er

Re: [Tutor] A simple Question...

2007-10-01 Thread John Fouhy
On 02/10/2007, Suzanne Peel <[EMAIL PROTECTED]> wrote: > I am trying to find the name of the file I am currently running (please > don't laugh at me I know it's simple but I cannot figure it out). Have a look at sys.argv[0] :-) -- John. ___ Tutor mai

Re: [Tutor] A simple Question...

2007-10-01 Thread Kent Johnson
Suzanne Peel wrote: > > Hi, > > I have a very simple question that I cannot find the answer to ... if I > knew the correct question to ask it would be simple. > > I am trying to find the name of the file I am currently running (please > don't laugh at me I know it's simple but I cannot figure

Re: [Tutor] creating the equivalent of string.strip()

2007-10-01 Thread Christopher Spears
I was looking for the source code for the strip functions at python.org. I didn't find anything. Do you or someone else know where the source code is posted? I tried to find python on my workstation, but I'm not sure where the sys admin installed it. _

[Tutor] OT: webhosting

2007-10-01 Thread Martin Walsh
wormwood_3 wrote: > There was another host that I wanted to mention along these lines (for Python > sites) that I think is even better: VPSLink (http://www.vpslink.com). They > allow root SSH access, and can install your choice of OS (lots of linux > flavors, ubuntu, SUSE, CentOS, etc) from a co

[Tutor] Update values stored as a list in a dictionary with values from another dictionary

2007-10-01 Thread GTXY20
Hello all, Let's say I have the following dictionary: {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)} I also have another dictionary for new value association: {a:1, b:2, c:3} How should I approach if I want to modify the first dictionary to read: {1:(1,2,3), 2:(1,3), 3:(2,3), 4:(1,d)} There is the p

Re: [Tutor] Update values stored as a list in a dictionary with values from another dictionary

2007-10-01 Thread John Fouhy
On 02/10/2007, GTXY20 <[EMAIL PROTECTED]> wrote: > Hello all, > > Let's say I have the following dictionary: > > {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)} > > I also have another dictionary for new value association: > > {a:1, b:2, c:3} > > How should I approach if I want to modify the first dictionar

[Tutor] A simple Question...

2007-10-01 Thread Suzanne Peel
Thankyou for your help, However both suggestions will only give me that name of the 1st file executed eg when I use execfile('EA_Owner.py') the name returned when the __file__ or sys.argv[0] is executed always EA_Owner.py . The Traceback feature is an excellent resource however the errors I