mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
bpo-43534: Fix the turtle module working with multiple root windows (GH-25591)
This commit is contained in:
parent
09aa6f914d
commit
8af929fc76
2 changed files with 8 additions and 8 deletions
|
@ -464,20 +464,18 @@ class TurtleScreenBase(object):
|
||||||
a corresponding TurtleScreenBase class has to be implemented.
|
a corresponding TurtleScreenBase class has to be implemented.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
def _blankimage(self):
|
||||||
def _blankimage():
|
|
||||||
"""return a blank image object
|
"""return a blank image object
|
||||||
"""
|
"""
|
||||||
img = TK.PhotoImage(width=1, height=1)
|
img = TK.PhotoImage(width=1, height=1, master=self.cv)
|
||||||
img.blank()
|
img.blank()
|
||||||
return img
|
return img
|
||||||
|
|
||||||
@staticmethod
|
def _image(self, filename):
|
||||||
def _image(filename):
|
|
||||||
"""return an image object containing the
|
"""return an image object containing the
|
||||||
imagedata from a gif-file named filename.
|
imagedata from a gif-file named filename.
|
||||||
"""
|
"""
|
||||||
return TK.PhotoImage(file=filename)
|
return TK.PhotoImage(file=filename, master=self.cv)
|
||||||
|
|
||||||
def __init__(self, cv):
|
def __init__(self, cv):
|
||||||
self.cv = cv
|
self.cv = cv
|
||||||
|
@ -811,7 +809,7 @@ class TurtleScreenBase(object):
|
||||||
>>> screen.mainloop()
|
>>> screen.mainloop()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
TK.mainloop()
|
self.cv.tk.mainloop()
|
||||||
|
|
||||||
def textinput(self, title, prompt):
|
def textinput(self, title, prompt):
|
||||||
"""Pop up a dialog window for input of a string.
|
"""Pop up a dialog window for input of a string.
|
||||||
|
@ -966,6 +964,8 @@ class TurtleScreen(TurtleScreenBase):
|
||||||
|
|
||||||
def __init__(self, cv, mode=_CFG["mode"],
|
def __init__(self, cv, mode=_CFG["mode"],
|
||||||
colormode=_CFG["colormode"], delay=_CFG["delay"]):
|
colormode=_CFG["colormode"], delay=_CFG["delay"]):
|
||||||
|
TurtleScreenBase.__init__(self, cv)
|
||||||
|
|
||||||
self._shapes = {
|
self._shapes = {
|
||||||
"arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))),
|
"arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))),
|
||||||
"turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7),
|
"turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7),
|
||||||
|
@ -989,7 +989,6 @@ class TurtleScreen(TurtleScreenBase):
|
||||||
|
|
||||||
self._bgpics = {"nopic" : ""}
|
self._bgpics = {"nopic" : ""}
|
||||||
|
|
||||||
TurtleScreenBase.__init__(self, cv)
|
|
||||||
self._mode = mode
|
self._mode = mode
|
||||||
self._delayvalue = delay
|
self._delayvalue = delay
|
||||||
self._colormode = _CFG["colormode"]
|
self._colormode = _CFG["colormode"]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed the :mod:`turtle` module working with non-default root window.
|
Loading…
Add table
Add a link
Reference in a new issue