Re: [Tutor] Inputting elements of a list

2007-01-22 Thread Bob Gailer
Luke Paireepinart wrote: > vanam wrote: > >> For standard input from the keyboard raw_input will be used for string >> and input for number.Suppose i want to input a list of some elements >> how could it be done. Actually i am looking for sorting out elements >> in a list.Below is the given s

Re: [Tutor] direction and draw

2007-01-22 Thread Kent Johnson
János Juhász wrote: > I wanted to test how can I response in a thread. > > All of my earlier responses started new threads in this list like this > http://mail.python.org/pipermail/tutor/2007-January/052169.html. > > Have I remove the '[Tutor]' or '[Tutor] ' from the subject of the response > ?

Re: [Tutor] metaclass question

2007-01-22 Thread Kent Johnson
Kim Branson wrote: > Hi i'm interested in implementing a factoryclass in python > > What i'd like to do is have my factoryClass produce an instance of a > class with some methods defined in arguments to the factory class. > > The classes that are produced have many common methods, but a single

Re: [Tutor] metaclass question

2007-01-22 Thread Alan Gauld
"Kim Branson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi i'm interested in implementing a factoryclass in python > > What i'd like to do is have my factoryClass produce an instance of a > class with some methods defined in arguments to the factory class. > > The classes that

Re: [Tutor] metaclass question

2007-01-22 Thread Andreas Kostyrka
Technically, you don't need metaclasses probably: class A(object): def methA(self, abc): pass def methB(self, def, ghi): pass def defaultMethod(self): raise UnknownMethodError() def __init__(self, methodName): self._calc = getattr(self, "meth%s" % me

Re: [Tutor] Are there any MAC OSX python users here?

2007-01-22 Thread Markus Rosenstihl
Am 22.01.2007 um 10:23 schrieb ALAN GAULD: Forwarding to list. --- Tony Cappellini <[EMAIL PROTECTED]> wrote: They need to start Applications-Utilities->Terminal It turned out that the users needed to change the permissions to +x, then the script would be invoked normally. Ah, but you spe

[Tutor] metaclass question

2007-01-22 Thread Kim Branson
Hi i'm interested in implementing a factoryclass in python What i'd like to do is have my factoryClass produce an instance of a class with some methods defined in arguments to the factory class. The classes that are produced have many common methods, but a single unique method. This method ac

Re: [Tutor] direction and draw

2007-01-22 Thread János Juhász
Dear Linda, > I have a segment (two ending points are A and B) which is 0 degree. > How to draw a segment with 10 degrees and 15 in length? It is very simple with complex numbers: import math class vect: ## begin and end are tuples (x, y) ## and represented as complex numbers def __i

[Tutor] problem with canvas.postscript()

2007-01-22 Thread Asrarahmed Kadri
Hi folks, I am trying to save a tkinter canvas using canvas.postscript() method... The thing works fine when the canvas size is small; but it gets cut (from the top and left side) when the size increases.. Here is the code: c.postscript(file=filename,height = canvas_height,width = canvas_width,

Re: [Tutor] Can we add labels to tkinter canvas..?

2007-01-22 Thread Michael Lange
On Mon, 22 Jan 2007 17:47:14 - "Alan Gauld" <[EMAIL PROTECTED]> wrote: > > "Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hello Folks, > > > > Is it possible to add a Label to tkinter canvas or i'll need to use > > create_text method ? > > What exactly

Re: [Tutor] Can we add labels to tkinter canvas..?

2007-01-22 Thread Alan Gauld
"Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Folks, > > Is it possible to add a Label to tkinter canvas or i'll need to use > create_text method ? What exactly do you expect a label in a canvas to do? Or to look like? You can attach a label to a canvas

Re: [Tutor] Better printing?

2007-01-22 Thread Alan Gauld
"Steve Nelson" <[EMAIL PROTECTED]> wrote > def getSize(fn): > """Get the size of a file in kb""" > fp = os.path.join(wp, fn) > if os.path.isfile(fp): >return os.stat(fp).st_size One problem with all of these is that you only return a value if it is a file. If its not a file you return N

Re: [Tutor] Variables of Variables

2007-01-22 Thread Danny Yoo
> Actually, I started off with a dictionary with a bunch of parameters. To > give you some background, I writing my > first GUI, and using the parameters in a dictionary to control what box the > GUI displays next. So, it looks > something that looks like this: > > data={'position':'middle', >

Re: [Tutor] Variables of Variables

2007-01-22 Thread Tino Dai
On 1/18/07, Danny Yoo <[EMAIL PROTECTED]> wrote: > Rather than storing your data as variables, you could store it in a > dictionary. Then you can dynamically access data however you like.. Suggesting a dictionary here is right. ** Stuff deleted about why using variables of variables is bad **

[Tutor] Can we add labels to tkinter canvas..?

2007-01-22 Thread Asrarahmed Kadri
Hello Folks, Is it possible to add a Label to tkinter canvas or i'll need to use create_text method ? Thanks in anticipation.. Best Regards, Asrarahmed Kadri -- To HIM you shall return. ___ Tutor maillist - Tutor@python.org http://mail.python.or

Re: [Tutor] How to import this program, and other questions

2007-01-22 Thread Dick Moores
At 01:56 AM 1/22/2007, ALAN GAULD wrote: >--- Dick Moores <[EMAIL PROTECTED]> wrote: > > > > ...Is the answer to put all 3 functions inside one big > > > one? > > > > > Probably not, its more likely to be a small function > > that checks its input parameters and calls one of > > the 3 worker funct

Re: [Tutor] direction and draw

2007-01-22 Thread Kent Johnson
linda.s wrote: > I have a segment (two ending points are A and B) which is 0 degree. > How to draw a segment with 10 degrees and 15 in length? Presumably you mean, how to draw a segment on screen? Are you using a GUI toolkit? Which one? Kent ___ Tutor

Re: [Tutor] Better printing?

2007-01-22 Thread Kent Johnson
Steve Nelson wrote: > Hello, > > See below a program that will go through a directory and for each file > print user, group, size and md5sum. > > A few questions: > > 1) It seems to fall over if I pass "." as a directory - how can I stop this? Falls over how? > 2) When I wrote the methods I de

Re: [Tutor] Are there any MAC OSX python users here?

2007-01-22 Thread ALAN GAULD
Forwarding to list. --- Tony Cappellini <[EMAIL PROTECTED]> wrote: > >>They need to start Applications-Utilities->Terminal > It turned out that the users needed to change the > permissions to +x, then the script would be > invoked normally. Ah, but you specifically said it was a command line

[Tutor] Better printing?

2007-01-22 Thread Steve Nelson
Hello, See below a program that will go through a directory and for each file print user, group, size and md5sum. A few questions: 1) It seems to fall over if I pass "." as a directory - how can I stop this? 2) When I wrote the methods I decided to do isafile() checks there, but subsequently rea

Re: [Tutor] Inputting elements of a list

2007-01-22 Thread Luke Paireepinart
vanam wrote: > For standard input from the keyboard raw_input will be used for string > and input for number.Suppose i want to input a list of some elements > how could it be done. Actually i am looking for sorting out elements > in a list.Below is the given script > list = [45,4,5] > list.sort(

Re: [Tutor] Inputting elements of a list

2007-01-22 Thread Alan Gauld
"vanam" <[EMAIL PROTECTED]> wrote > For standard input from the keyboard raw_input will be used for > string and > input for number. input can read more than numbers. It will take whatever you type and try to evaluate it as a Python expression. That's why input is so dangerous and should be avoi

Re: [Tutor] pyw bug ?

2007-01-22 Thread Luke Paireepinart
Dave S wrote: > Hi all, > > My GUI app dumps some diagnostic output to the terminal, starting it from an > XP terminal, all is well. > > Starting it as app.pyw so no terminal is needed - and err - the app randomly > locks because the diagnostic output is - backing up ? Hmm, maybe check where sys.

Re: [Tutor] direction and draw

2007-01-22 Thread Luke Paireepinart
linda.s wrote: > I have a segment (two ending points are A and B) which is 0 degree. > How to draw a segment with 10 degrees and 15 in length? > You'll need a pen, some paper, a protractor, a ruler, and a steady hand. Good luck. -Luke ___ Tutor mailli

[Tutor] Inputting elements of a list

2007-01-22 Thread vanam
For standard input from the keyboard raw_input will be used for string and input for number.Suppose i want to input a list of some elements how could it be done. Actually i am looking for sorting out elements in a list.Belowis the given script list = [45,4,5] list.sort() for y in list: print y -