Re: [Tutor] Decorators, I am confused.

2005-07-14 Thread Alan G
> class testObj(object): >_rules = list() >def evalRules(self): >for r in _rules: >r() >def rule(func): >if not func in func.__class__._rules: >... >def arule(self): >print a Can you explain in plain English what testObj does? I don;t unders

Re: [Tutor] Decorators, I am confused.

2005-07-14 Thread Kent Johnson
David Driver wrote: > What I would like to do is something like this: > > class testObj(object): > _rules = list() > def evalRules(self): > for r in _rules: > r() > def rule(func): > if not func in func.__class__._rules: > func.__class__._rules.a

Re: [Tutor] python newbie..system call help

2005-07-14 Thread Martin Walsh
Mike Pindzola wrote: > I have figured many things out. system works, i just forgot to type > os.system(). I have been looking into the os module and am finding alot > of useful stuff. I still need to workout the best way to ask a user for > a root password, show when typed and then pass it

Re: [Tutor] regular expressions

2005-07-14 Thread Danny Yoo
> I am working on creating a Domain Specific Language that will > solve partial differential equations. The user will enter a equation in > pseudo code format. [Grammar cut] > It was decided to use Spark for the base for the compiler. To use Spark > all that is need is to just add a new c

Re: [Tutor] Catching OLE error

2005-07-14 Thread Danny Yoo
> > So the errors are getting raised before Python even knows there is a > > problem, so it cannot catch them in an except block. From my very > > limited expoerience of COM programming I'd guess that there is a type > > mismatch somewhere either in the data you are passing in or in the > > data y

Re: [Tutor] ot, " pythonmonks

2005-07-14 Thread Danny Yoo
On Thu, 14 Jul 2005, Johan Meskens CS3 jmcs3 wrote: > is there such a place as www.perlmonks.org for python ? Hi Johan, Perlmonks is an excellent resource for Perl programmers; I don't believe that any single Python-oriented place has the same feature set, although I could be wrong. There a

[Tutor] Decorators, I am confused.

2005-07-14 Thread David Driver
What I would like to do is something like this: class testObj(object): _rules = list() def evalRules(self): for r in _rules: r() def rule(func): if not func in func.__class__._rules: func.__class__._rules.append(func) print testis._ru

Re: [Tutor] Catching OLE error

2005-07-14 Thread Bernard Lebel
Thanks Alan, I'll check it out. Cheers Bernard On 7/14/05, Alan G <[EMAIL PROTECTED]> wrote: > > Isn't the OLEError alike the ValueError, KeyError and so on? > > If so shouldn't it go before the colon? > > The problem, as I understand it, is that OLEError is not coming > from Python but from

Re: [Tutor] HTML links from Tkinter

2005-07-14 Thread jfouhy
Quoting Alberto Troiano <[EMAIL PROTECTED]>: > Is there any way that I can link a button to go to certain web page? > and how can I do that? If you want to open a web page in the user's default browser, check out the webbrowser module in the standard library. If you want to go to a website and s

[Tutor] HTML links from Tkinter

2005-07-14 Thread Alberto Troiano
Hey tutors I was wondering I'm making an telephone guide with Tkinter and I need to show a search in a table Like most php pages do Is there any way that I can link a button to go to certain web page? and how can I do that? Another thing, I'll make a query by name and I want to show every results

Re: [Tutor] Tkinter query?

2005-07-14 Thread jfouhy
Quoting Dave S <[EMAIL PROTECTED]>: > Thank you, that has clarified a few points but raised a query. > tk.geometry('400x400') does not appear to have any effect on its size > when the window is drawn, the window is always the same size and short > of maximizing it to full screen it is not adjustab

Re: [Tutor] Tk -- which label clicked

2005-07-14 Thread jfouhy
Quoting Ron Weidner <[EMAIL PROTECTED]>: > Or, more to the point... I need to dynamicaly create > clickable labels, each using the same callback. When > clicked, I need to know which one was clicked. I was > hoping to use the "text" of the label as the argument > to another function. You've got o

Re: [Tutor] Tkinter query?

2005-07-14 Thread jfouhy
Quoting Ron Weidner <[EMAIL PROTECTED]>: > > > tk = Tk() > > > tk.config(background='pink') > > > tk.geometry('400x400') > > > > > tk.geometry( "320x150+200+200") Hmm. In my experience, a call like tk.geometry('400x400') will resize tk without moving it... -- John. ___

Re: [Tutor] regular expressions

2005-07-14 Thread jfouhy
Quoting Servando Garcia <[EMAIL PROTECTED]>: > Hello List > I am working on creating a Domain Specific Language that will solve > partial differential equations. The user will enter a equation in > pseudo code format. I will need to parse the equation. Here is the BNF > for the equation .

Re: [Tutor] Catching OLE error

2005-07-14 Thread Alan G
> Isn't the OLEError alike the ValueError, KeyError and so on? > If so shouldn't it go before the colon? The problem, as I understand it, is that OLEError is not coming from Python but from COM. So the errors are getting raised before Python even knows there is a problem, so it cannot catch th

Re: [Tutor] Catching OLE error

2005-07-14 Thread Alan G
> I just noticed you put OLEError before the colon you should have > except: OLEError print "ole" I doubt if that would work effectively. > if that doesn't work you could just get rid of the OLEError bit > and all errors will be ignored. And that is decidedly dangerous unless you are sure that

[Tutor] regular expressions

2005-07-14 Thread Servando Garcia
Hello List I am working on creating a Domain Specific Language that will solve partial differential equations. The user will enter a equation in pseudo code format. I will need to parse the equation. Here is the BNF for the equation := :=Do :=() :=, | := = :=A() :=() := , | := |

Re: [Tutor] Catching OLE error

2005-07-14 Thread Bernard Lebel
Isn't the OLEError alike the ValueError, KeyError and so on? If so shouldn't it go before the colon? Thanks Bernard On 7/14/05, Adam Bark <[EMAIL PROTECTED]> wrote: > I just noticed you put OLEError before the colon you should have > except: > OLEError > print "ole" > > if that do

Re: [Tutor] Catching OLE error

2005-07-14 Thread Adam Bark
I just noticed you put OLEError before the colon you should have except:     OLEError     print "ole" if that doesn't work you could just get rid of the OLEError bit and all errors will be ignored.On 7/14/05, Bernard Lebel < [EMAIL PROTECTED]> wrote:Very well.#INFO : < NewRenderShot > importAnimat

Re: [Tutor] Tk -- which label clicked

2005-07-14 Thread Ron Weidner
--- geon <[EMAIL PROTECTED]> wrote: > Ron Weidner napsal(a): > > >This doesn't work. > >def icon_click(self, event=None): > > print event.widget.option_get("text", > event.widget) > > > > > > > maybe event.widget['text'] ? event.widget['text'] works. Thanks. Ronald Weidner http://www.

Re: [Tutor] PIL's palette

2005-07-14 Thread D. Hartley
Peter, This does make the issue of palettes a lot clearer, thank you. I'll have to see if it is something I can apply to my present task. Thanks for your help, everyone! ~Denise ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailma

Re: [Tutor] Tk -- which label clicked

2005-07-14 Thread geon
Ron Weidner napsal(a): >This doesn't work. Not an error though. :) What I'm >trying to do is get the text value of a label. > >def icon_click(self, event=None): > print event.widget.option_get("text", event.widget) > > > maybe event.widget['text'] ? what else you can put into brackets?: print

[Tutor] Tk -- which label clicked

2005-07-14 Thread Ron Weidner
This doesn't work. Not an error though. :) What I'm trying to do is get the text value of a label. def icon_click(self, event=None): print event.widget.option_get("text", event.widget) Or, more to the point... I need to dynamicaly create clickable labels, each using the same callback. When

Re: [Tutor] PIL's palette

2005-07-14 Thread Peter Szinek
Hello, D. Hartley wrote: >>Your palette is a LookUp Table (LUT) - it is also named like this in >>your prog ('lut') - which is a 768-long list (or as in this case, a list >>of 256 lists, every inner list has 3 elements - so again you have 768 >>elements). So 3x256 or 1x768 is just an implementatio

Re: [Tutor] PIL's palette

2005-07-14 Thread Kent Johnson
D. Hartley wrote: > Hello, everyone! > > I am trying to figure out what a palette actually is, how it works, > and what PIL's "putpalette()" does with a given data set (it has to be > a string, I believe). PIL's documentation says very close to nothing > at all, and googling it has given me sever

Re: [Tutor] Tkinter query?

2005-07-14 Thread Ron Weidner
> > tk = Tk() > > tk.config(background='pink') > > tk.geometry('400x400') > > # 320 = width # 150 = height # # Left and down are relative to the screens uppeer left # # 200 = position left (x) # 200 = position down (y) tk.geometry( "320x150+200+200") hth Ronald Weidner http://www.techport80.c

Re: [Tutor] PIL's palette

2005-07-14 Thread Peter Szinek
Can you pls send me the image you ar working with? D. Hartley wrote: >>Your palette is a LookUp Table (LUT) - it is also named like this in >>your prog ('lut') - which is a 768-long list (or as in this case, a list >>of 256 lists, every inner list has 3 elements - so again you have 768 >>elements

Re: [Tutor] PIL's palette

2005-07-14 Thread D. Hartley
> Your palette is a LookUp Table (LUT) - it is also named like this in > your prog ('lut') - which is a 768-long list (or as in this case, a list > of 256 lists, every inner list has 3 elements - so again you have 768 > elements). So 3x256 or 1x768 is just an implementation detail. Let's see > the

Re: [Tutor] Tkinter query?

2005-07-14 Thread Dave S
> > Frames are used to help with positioning other widgets, yes. They are > also used > to affect how the application looks: you can change the background > colour of > Frames, and also the border (to make them look like they are sticking > out, for > example). But you can (and frequently will) pu

Re: [Tutor] Questions on file.read

2005-07-14 Thread Alan G
> Notice that when in non-blocking mode, less data than what was > requested > may be returned, even if no size parameter was given. > > What does "blocking-mode" mean, Its easier to answer by explaining blocking mode. In blocking mode the read will wait(block) until size bytes are available. Thi

Re: [Tutor] Catching OLE error

2005-07-14 Thread Bernard Lebel
Very well. #INFO : < NewRenderShot > importAnimation> :: Import action for character ""... #ERROR : 2000 - Argument 0 (Source) is invalid #ERROR : 2001-ANIM-ApplyAction - Argument 0 is invalid - [line 3543 in D:\Software\Softimage\XSI_4.2\Application\DSScripts\action.vbs] #ERROR : 21000-ANIM-Impo

[Tutor] Catching OLE error

2005-07-14 Thread Adam Bark
Can you send me the output for an OLE error? The correct syntax should be included in the error message like this: Traceback (most recent call last):   File "", line 1, in ? TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' TypeError would be the exception so you would have: try

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Max Noel wrote: > In any cas, you should try to avoid using file.read without a size > parameter. If you're processing text files, reading them one line at a > time would be a good start (for line in open ('filename.txt'): is an > instance of Best Thing Ever). Yes, this is good advice, if

[Tutor] Catching OLE error

2005-07-14 Thread Bernard Lebel
Hello, A simple question: what is the syntax in a try/except for the OLE error? Let say you want to catch OLE error: try: print stuff except OLEError: print 'ole' Now the problem is that I just can't seem to find anything how the exact grammar of this error! I have looked in the Python document

Re: [Tutor] Minesweeper implementing 20%, weird problem with matrixes

2005-07-14 Thread Alberto Troiano
Hey I didn't notice that :P Thanks to Alan, I learn something new with the use of List Comprehension and thanks to Danny for the docs, they really helped a lot to understand the figure here I think I can say that Minesweeper implementing 23% with this problem solved Thanks a lot Alberto >From

Re: [Tutor] Questions on file.read

2005-07-14 Thread Max Noel
On Jul 14, 2005, at 12:26, Negroup - wrote: "To read a file's contents, call f.read(size), which reads some quantity of data and returns it as a string. size is an optional numeric argument. When size is omitted or negative, the entire contents of the file will be read and returned; it's your p

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Negroup - wrote: > read(...) > read([size]) -> read at most size bytes, returned as a string. > > If the size argument is negative or omitted, read until EOF is reached. > Notice that when in non-blocking mode, less data than what was requested > may be returned, even if no size pa

Re: [Tutor] Virtual keyboard

2005-07-14 Thread Alan G
>> If you want your virtual keyboard to type in any program you will >> have to >> deal with focus issues and it seems to me that would be hard, if >> possible. > > I do want it to type in any entry (websites, notepad and other > programs), and thats what makes it harder. I dont think that > sho

[Tutor] ot, " pythonmonks

2005-07-14 Thread Johan Meskens CS3 jmcs3
hello is there such a place as www.perlmonks.org for python ? kind regards jmcs3 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OT python Licences

2005-07-14 Thread R. Alan Monroe
> As far as I know, all GTK+ 2.x > applications under Windows have a native look. I don't know my self as > I don't have Windows. My personal experience is that GTK apps (Ones I've used like GAIM, Inkscape, Ethereal) on Windows stick out like a sore thumb, GUI-wise. They tend not to use the same

[Tutor] Questions on file.read

2005-07-14 Thread Negroup -
>>> help(f.read) Help on built-in function read: read(...) read([size]) -> read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be return

Re: [Tutor] PIL's palette

2005-07-14 Thread Peter Szinek
Hey, DH>I am trying to figure out what a palette actually is, how it works, I did this V long time ago (10+ years) in C-- (it was an embellished assembler) so don't kill me if this works other way in python/PIL, but as far as i remember, it worked like this: Your palette is a LookU

Re: [Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
On 7/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > You would need some way of getting a handle for the widget you want to type > into.. I don't know how to do this (or even if you can), but I wonder if you > might have more luck if you used PythonWin and the Microsoft factory classes > to

Re: [Tutor] Virtual keyboard

2005-07-14 Thread jfouhy
Quoting Mark Kels <[EMAIL PROTECTED]>: > I do want it to type in any entry (websites, notepad and other > programs), and thats what makes it harder. I dont think that shouldnt > be too hard as well, but I have no idea how to do it. You would need some way of getting a handle for the widget you wa

Re: [Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
On 7/14/05, luke <[EMAIL PROTECTED]> wrote: > I don't think it will be hard, but it depends what you want to pass > keypresses to. > If you want your virtual keyboard to type in any program you will have to > deal with > focus issues and it seems to me that would be hard, if possible. > but if you

[Tutor] Virtual keyboard

2005-07-14 Thread Mark Kels
Hi list. I want to make a virtual keyboard with Tkinter. Can I have some pointers on how to do it? Will it be hard (it doesn't look so hard...)? Thanks. -- 1. The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. 2. Unix is user friendly - i

Re: [Tutor] OT python Licences

2005-07-14 Thread Sandip Bhattacharya
Don Parris wrote: > Commercial users, or non-free users? Remember that libre software *can* be > distributed commercially as well. In fact, the FSF encourages people to do > so - it's one of the freedoms afforded by the GPL. > I agree. Libre software can be distributed commercially, as long as