Re: [Tutor] SubClassing

2005-02-24 Thread Ismael Garrido
Sean Perry wrote: yep. call 'Parent.__init__(this, that)' then do 'self.new = new' def __init__(self, this, that, new): Parent.__init__(this, that) self.new = new Thanks. Though it should be: def __init__(self, this, that, new): Parent.__init__(self, this, that) #note self self.new =

[Fwd: Re: [Tutor] Recursive Tkinter buttons]

2005-02-24 Thread Ismael Garrido
Sent only to Liam... Forwading.. Original Message Subject: Re: [Tutor] Recursive Tkinter buttons Date: Fri, 25 Feb 2005 05:45:00 -0200 From: Ismael Garrido <[EMAIL PROTECTED]> To: Liam Clarke <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PRO

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Liam Clarke
> > for i in range(0,10): > print i > buttonlabel = "field " +str(i) > button[i].append = Button (text=buttonlabel) > button[i].grid(column=3, row = i+3) > > The current

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Adam Cripps
On Thu, 24 Feb 2005 21:26:29 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Adam Cripps wrote: > > I'm trying to create recursive Tkinter buttons with: > > > > for i in range(0,10): > > print i > > buttonlabel = "field " +str(i) > >

Re: [Tutor] SubClassing

2005-02-24 Thread Sean Perry
Ismael Garrido wrote: Hello My code is like this: class Parent: def __init__(self, bunch, of, variables): self.bunch, self.of, self.variables = bunch, of, variables class Son(Parent): def __init__(self, bunch, of, variables, new): self.bunch, self.of, self.variables, self.new = bu

[Tutor] SubClassing

2005-02-24 Thread Ismael Garrido
Hello My code is like this: class Parent: def __init__(self, bunch, of, variables): self.bunch, self.of, self.variables = bunch, of, variables class Son(Parent): def __init__(self, bunch, of, variables, new): self.bunch, self.of, self.variables, self.new = bunch, of, variables, n

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Kent Johnson
Adam Cripps wrote: I'm trying to create recursive Tkinter buttons with: for i in range(0,10): print i buttonlabel = "field " +str(i) button[i] = Button (text=buttonlabel) button[i].grid(c

RE: [Tutor] Reading Tutor with gmail: monospace fonts

2005-02-24 Thread John Purser
Thanks for the tip. John Purser -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Dunn Sent: Thursday, February 24, 2005 14:43 To: tutor@python.org Subject: [Tutor] Reading Tutor with gmail: monospace fonts Hi all, This is slightly off topic, but

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread jfouhy
Quoting Danny Yoo <[EMAIL PROTECTED]>: > I think that only widgets that are designated as "containers" can > contain other widgets. A Frame is an example of a widget that can contain > other widgets: This is (I think) true; but the root can also contain widgets, and it is the default if no other

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Danny Yoo
On Thu, 24 Feb 2005, Adam Cripps wrote: > I'm trying to create recursive Tkinter buttons with: > > for i in range(0,10): > print i > buttonlabel = "field " +str(i) > button[i] = Button (text=buttonlabel) >

[Tutor] Reading Tutor with gmail: monospace fonts

2005-02-24 Thread Michael Dunn
Hi all, This is slightly off topic, but I've noticed a lot of people are using gmail accounts to post to tutor and I just wanted to share a useful trick I just learned for making gmail display and edit mail with a monospace rather than proportional font. I'm sure anyone who's tried it agrees that

[Tutor] Recursive Tkinter buttons

2005-02-24 Thread Adam Cripps
I'm trying to create recursive Tkinter buttons with: for i in range(0,10): print i buttonlabel = "field " +str(i) button[i] = Button (text=buttonlabel) button[i].grid(column=3, row = i+3

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Michael Dunn
Hi Luke, > Is there a way to preserve the readability of the code and have > printed text from indented blocks, say, nested conditionals, appear > flush at left, not printed exactly where I've written them in the > script? you can use the textwrap module for this. >>> from textwrap import dedent

Re: [Tutor] Unicode issues

2005-02-24 Thread Kent Johnson
Michael Lange wrote: Ok, user input must be checked whether it's unicode or not and if necessary be decoded to unicode with system encoding. For internal operations I should then use only unicode strings and if I need to print something to stdout I must encode it again with system encoding, righ

Re: [Tutor] Unicode issues

2005-02-24 Thread Michael Lange
On Thu, 24 Feb 2005 07:51:04 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > Michael Lange wrote: > > I *thought* I would have to convert the user input which might be any > > encoding back into > > byte string first > > How are you getting the user input? Is it from the console or from a GUI?

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
On Thu, 24 Feb 2005 14:23:28 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > >>class foo: > >>def bar(self): > > > > > > Sorry, I forgot that if it's in the module, you should declare prompt1 > > as global by using "global prompt1" right here. > > > > > >>print promp

[Tutor] Python Online Programming Contest

2005-02-24 Thread Varun Soundararajan
Hi Friends, Department of Information Technology, Madras Institute of Technology, Anna University is conducting a technical symposium, Samhita. As a part of samhita, an Online Programming Contest is scheduled on Sunday, 27 Feb 2005. This is the first Online Programming Contest in India to support

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Danny Yoo
> > > > I'm writing a simple game (run in command line) in which narrative > > > > text is printed in response to a user's decisions. The problem I'm > > > > running into is that triple quotes used in an indented block > > > > preserves the indentation when it prints. [text cut] > > > Why not j

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Kent Johnson
Bill Mill wrote: class foo: def bar(self): Sorry, I forgot that if it's in the module, you should declare prompt1 as global by using "global prompt1" right here. print prompt1 % (var1, var2, var3) No, you only need the global statement if you want to assign to a global variable. Read-on

Re: [Tutor] Interpreter level objects

2005-02-24 Thread Danny Yoo
On Wed, 23 Feb 2005, Jacob S. wrote: > Say I put the code > > import psyco > psyco.full() > > in sitecustomize.py and run a random file that I have already got an > average execution time of. Then I run it again, with the above > implemented. My execution time is has dropped. Which brings me to

Re: [Tutor] Precompiling to bytecode

2005-02-24 Thread Danny Yoo
On Thu, 24 Feb 2005, Smith, Jeff wrote: > I notice that python only pre-compiles imported modules and not the main > script. The only way I seem to be able to get this to happen is to run > > python -c "import mainscript" Hi Jeff, Python automatically tries to compile module code on an 'imp

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Luke Jordan
Execllent. Many Thanks, Luke On Thu, 24 Feb 2005 13:15:41 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > On Thu, 24 Feb 2005 13:14:13 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > > On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > >

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
On Thu, 24 Feb 2005 13:14:13 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I've tried a lot of experimenting and searching through various > > tutorials, and I haven't been able to come up with a solution

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Bill Mill
On Thu, 24 Feb 2005 10:02:44 -0800, Luke Jordan <[EMAIL PROTECTED]> wrote: > Hi all, > > I've tried a lot of experimenting and searching through various > tutorials, and I haven't been able to come up with a solution to this, > ostensibly simple, problem. > > I'm writing a simple game (run in com

[Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Luke Jordan
Hi all, I've tried a lot of experimenting and searching through various tutorials, and I haven't been able to come up with a solution to this, ostensibly simple, problem. I'm writing a simple game (run in command line) in which narrative text is printed in response to a user's decisions. The prob

Re: [Tutor] threads

2005-02-24 Thread =?ISO-8859-1?Q?Hugo_Gonz=E1lez_Monteverde?=
OK, as ignorant as I may be on threads, I have read a bit on Stackless Python's tasklets. Suppossedly they require much less memory than python's threads. Information is at www.stackless.com Hugo Shitiz Bansal wrote: Hi, I am trying to build a traffic network simulator using python, for my degre

[Tutor] Precompiling to bytecode

2005-02-24 Thread Smith, Jeff
I notice that python only pre-compiles imported modules and not the main script. The only way I seem to be able to get this to happen is to run python -c "import mainscript" Am I missing something? Thanks, Jeff ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Unicode issues

2005-02-24 Thread Kent Johnson
Michael Lange wrote: I *thought* I would have to convert the user input which might be any encoding back into byte string first How are you getting the user input? Is it from the console or from a GUI? I think the best strategy is to try to keep all your strings as Unicode. Unicode is the only en

[Tutor] Unicode issues (was: UnicodeDecodeError)

2005-02-24 Thread Michael Lange
On Wed, 23 Feb 2005 23:16:20 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > How about >n = self.nextfile >if not isinstance(n, unicode): > n = unicode(n, 'iso8859-1') > ? > > > At least this might explain why "A\xe4" worked and "\xe4" not as I > > mentioned in a previous post. > >