[issue21597] Allow turtledemo code pane to get wider.

Terry J. Reedy report at bugs.python.org
Wed Jul 23 05:20:22 CEST 2014


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

Am I missing something?  Just curious, what is the <Configure> event? Or rather, what generates it?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21597>
_______________________________________


More information about the Python-bugs-list mailing list