Lita Cho added the comment: On Tue, Jul 22, 2014 at 8:20 PM, Terry J. Reedy <rep...@bugs.python.org> wrote:
> > Terry J. Reedy added the comment: > > I reviewed code and made the following changes in uploaded file: > Move some code and blank lines around. > Since you left packing within mBar frame, removed > self.mBar.grid_columnconfigure(0, weight=1) > Since the only thing packed in the left frame was the text frame, renamed > makeLeftFrame to makeTextFrame, removed the left frame and returned the > text frame to be gridded directly. Works fine. > Remove left_frame, graph_frame temporaries. > > The questions that stopped me from pushing this are about the following > lines in makeGraphicFrame. > > self._canvas = turtle.ScrolledCanvas(root, > 800, 600, > self.canvwidth, > self.canvheight) > turtle._Screen._canvas = self._canvas #* > turtle._Screen._canvas.adjustScrolls() > turtle._Screen._canvas._rootwindow.bind('<Configure>', > self.onResize) > turtle._Screen._canvas._canvas['borderwidth'] = 0 > turtle._Screen._canvas.grid(row=0, column=0, sticky='news') ## > ... > return turtle._Screen._canvas > It seems that in all lines except #*, 'turtle._Screen._canvas' could be > replaced by 'self._canvas' or even a 'canvas' temporary. The ## line seems > wrong, as the parent is root and 0,0 is not where the canvas shoud be > gridded and indeed not where it is gridded after being returned. The demo > seems fine after commenting out the line. So it seems that the following > should work. > > self._Screen._canvas = self._canvas = canvas = ( > turtle.ScrolledCanvas( > root, 800, 600, self.canvwidth, self.canvheight)) > canvas.adjustScrolls() > canvas._rootwindow.bind('<Configure>', self.onResize) > canvas._canvas['borderwidth'] = 0 > ... > return canvas > Yes! I like this a lot better. turtle._Screen._canvas was how the canvas was being manipulated before. I was trying to follow the original programmer's convention, but that works perfectly! > > Am I missing something? Just curious, what is the <Configure> event? Or > rather, what generates it? > > The Configure event is triggered when the widget changes size. It is super confusing. Look for '<Configure>' in the documentation here: http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm I had to override Turtle's onResize metbod because the canvas wasn't centering properly when the sash was being moved. > ---------- > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue21597> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21597> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com