Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: Lib/turtle.py

Issue 11571: Turtle window pops under the terminal on OSX
Patch Set: Created 8 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # turtle.py: a Tkinter based turtle graphics module for Python 2 # turtle.py: a Tkinter based turtle graphics module for Python
3 # Version 1.1b - 4. 5. 2009 3 # Version 1.1b - 4. 5. 2009
4 # 4 #
5 # Copyright (C) 2006 - 2010 Gregor Lingl 5 # Copyright (C) 2006 - 2010 Gregor Lingl
6 # email: glingl@aon.at 6 # email: glingl@aon.at
7 # 7 #
8 # This software is provided 'as-is', without any express or implied 8 # This software is provided 'as-is', without any express or implied
9 # warranty. In no event will the authors be held liable for any damages 9 # warranty. In no event will the authors be held liable for any damages
10 # arising from the use of this software. 10 # arising from the use of this software.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 _ver = "turtle 1.1b- - for Python 3.1 - 4. 5. 2009" 103 _ver = "turtle 1.1b- - for Python 3.1 - 4. 5. 2009"
104 104
105 # print(_ver) 105 # print(_ver)
106 106
107 import tkinter as TK 107 import tkinter as TK
108 import types 108 import types
109 import math 109 import math
110 import time 110 import time
111 import os 111 import os
112 import inspect 112 import inspect
113 import sys
113 114
114 from os.path import isfile, split, join 115 from os.path import isfile, split, join
115 from copy import deepcopy 116 from copy import deepcopy
116 from tkinter import simpledialog 117 from tkinter import simpledialog
117 118
118 _tg_classes = ['ScrolledCanvas', 'TurtleScreen', 'Screen', 119 _tg_classes = ['ScrolledCanvas', 'TurtleScreen', 'Screen',
119 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D'] 120 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D']
120 _tg_screen_functions = ['addshape', 'bgcolor', 'bgpic', 'bye', 121 _tg_screen_functions = ['addshape', 'bgcolor', 'bgpic', 'bye',
121 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas', 122 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas',
122 'getshapes', 'listen', 'mainloop', 'mode', 'numinput', 123 'getshapes', 'listen', 'mainloop', 'mode', 'numinput',
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 987 }
987 988
988 self._bgpics = {"nopic" : ""} 989 self._bgpics = {"nopic" : ""}
989 990
990 TurtleScreenBase.__init__(self, cv) 991 TurtleScreenBase.__init__(self, cv)
991 self._mode = mode 992 self._mode = mode
992 self._delayvalue = delay 993 self._delayvalue = delay
993 self._colormode = _CFG["colormode"] 994 self._colormode = _CFG["colormode"]
994 self._keys = [] 995 self._keys = []
995 self.clear() 996 self.clear()
997
998 if sys.platform == 'darwin':
999 # Force Turtle window to the front on OSX. This is needed
1000 # because the Turtle window will show behind the Terminal
1001 # window when you show the turtle window from the command-line.
1002 cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '1')
1003 cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '0')
996 1004
997 def clear(self): 1005 def clear(self):
998 """Delete all drawings and all turtles from the TurtleScreen. 1006 """Delete all drawings and all turtles from the TurtleScreen.
999 1007
1000 No argument. 1008 No argument.
1001 1009
1002 Reset empty TurtleScreen to its initial state: white background, 1010 Reset empty TurtleScreen to its initial state: white background,
1003 no backgroundimage, no eventbindings and tracing on. 1011 no backgroundimage, no eventbindings and tracing on.
1004 1012
1005 Example (for a TurtleScreen instance named screen): 1013 Example (for a TurtleScreen instance named screen):
(...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after
4130 while undobufferentries(): 4138 while undobufferentries():
4131 tri.undo() 4139 tri.undo()
4132 turtle.undo() 4140 turtle.undo()
4133 tri.fd(50) 4141 tri.fd(50)
4134 tri.write(" Click me!", font = ("Courier", 12, "bold") ) 4142 tri.write(" Click me!", font = ("Courier", 12, "bold") )
4135 tri.onclick(baba, 1) 4143 tri.onclick(baba, 1)
4136 4144
4137 demo1() 4145 demo1()
4138 demo2() 4146 demo2()
4139 exitonclick() 4147 exitonclick()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+