Windows Stack Size

Michael Muller proteus at cloud9.net
Tue Jun 1 13:09:44 EDT 1999


Guido van Rossum wrote:
[snip]
> > I've experienced some traps creating some deeply nested Tkinter controls
> > under windows and I'm wondering if it could be due to a stack overflow.
> 
> If it is indeed a stack overflow, the cause is more likely infinite
> recursion on
> your part.
> 
> --Guido van Rossum

AFAIK, the code is not recursive (sometimes with GUI callbacks, you can 
get a lot deeper into the stack than you might expect :-).  It's been 
running fine under Linux for months, but under Win 95 it traps
consistantly in some windows, _but not in all of them_, which is why I 
thought there might be a tiny-stack issue. 1 meg should be plenty of
room.  
Here is the control in question:

class ScrollingText(Frame):
   
   def __init__(self, parent = None, **kw):
      self.text = None
      if parent:
         Frame.__init__(self, parent)
      else:
         Frame.__init__(self)
      self.text = apply(Text, (self,), kw)
      self.text.grid(sticky = N+S+E+W)
      
      self.vsb = Scrollbar(self, command = self.text.yview)
      self.vsb.grid(row = 0, column = 1, sticky = N+S)
      
      self.hsb = Scrollbar(self, command = self.text.xview,
                           orient = 'horizontal'
                           )
      self.hsb.grid(sticky = W+E)
      
      self.text.config(yscrollcommand = self.vsb.set,
                       xscrollcommand = self.hsb.set,
                       wrap = 'none'
                       )
      self.rowconfigure(0, weight = 1)
      self.columnconfigure(0, weight = 1)
   
   def __getattr__(self, attr):
      if self.text:
         return getattr(self.text, attr)
      else:
         raise AttributeError(attr)

Upon further consideration, I wonder if the getattr could have something
to do with this.

I'd debug it myself except that I'm happily Windows-free (only creates
problems when I have to write code for Windows users).  If there is no
obvious answer, I have a work-around.

=============================================================================
michaelMuller = proteus at cloud9.net | http://www.cloud9.net/~proteus
-----------------------------------------------------------------------------
In this book it is spoken of the Sephiroth, and the Paths, of Spirits
and
Conjurations; of Gods, Spheres, Planes and many other things which may
or
may not exist.  It is immaterial whether they exist or not.  By doing
certain things certain results follow. - Aleister Crowley
=============================================================================




More information about the Python-list mailing list