diff -r d0570cba3749 Lib/turtledemo/__main__.py --- a/Lib/turtledemo/__main__.py Sat Jul 26 19:40:16 2014 -0400 +++ b/Lib/turtledemo/__main__.py Sat Jul 26 23:22:35 2014 -0400 @@ -21,7 +21,7 @@ menufont = ("Arial", 12, NORMAL) btnfont = ("Arial", 12, 'bold') -txtfont = ('Lucida Console', 8, 'normal') +txtfont = ['Lucida Console', 8, 'normal'] def getExampleEntries(): return [entry[:-3] for entry in os.listdir(demo_dir) if @@ -102,7 +102,7 @@ hbar['command'] = text.xview hbar.pack(side=BOTTOM, fill=X) - text['font'] = txtfont + text['font'] = tuple(txtfont) text['yscrollcommand'] = vbar.set text['xscrollcommand'] = hbar.set text.pack(side=LEFT, fill=BOTH, expand=1) @@ -115,7 +115,7 @@ turtle._Screen._canvas = self._canvas = canvas = turtle.ScrolledCanvas( root, 800, 600, self.canvwidth, self.canvheight) canvas.adjustScrolls() - canvas._rootwindow.bind('', self.onResize) + self._makeBindings(canvas._rootwindow) canvas._canvas['borderwidth'] = 0 self.screen = _s_ = turtle.Screen() @@ -124,6 +124,29 @@ turtle.RawTurtle.screens = [_s_] return canvas + def _makeBindings(self, widget): + if sys.platform == 'darwin': + shortcut = 'Command' + else: + shortcut = 'Control' + widget.bind('', self.onResize) + widget.bind_all('<%s-minus>' % shortcut, self._decreaseFont) + widget.bind_all('<%s-=>' % shortcut, self._increaseFont) + widget.bind_all('<%s-plus>' % shortcut, self._increaseFont) + widget.bind_all('', self._updateFont) + + def _updateFont(self, event): + txtfont[1] += event.delta // 120 + self.text['font'] = tuple(txtfont) + + def _decreaseFont(self, dummy): + txtfont[1] -= 1 + self.text['font'] = tuple(txtfont) + + def _increaseFont(self, dummy): + txtfont[1] += 1 + self.text['font'] = tuple(txtfont) + def configGUI(self, menu, start, stop, clear, txt="", color="blue"): self.ExamplesBtn.config(state=menu)