Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4f38e483
Kaydet (Commit)
4f38e483
authored
Şub 22, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #6639: Module-level turtle functions no longer raise TclError after
closing the window.
üst
bf1f376b
80a18031
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
34 deletions
+40
-34
turtle.py
Lib/turtle.py
+33
-34
__main__.py
Lib/turtledemo/__main__.py
+4
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/turtle.py
Dosyayı görüntüle @
4f38e483
...
@@ -1288,7 +1288,7 @@ class TurtleScreen(TurtleScreenBase):
...
@@ -1288,7 +1288,7 @@ class TurtleScreen(TurtleScreenBase):
def
_incrementudc
(
self
):
def
_incrementudc
(
self
):
"""Increment update counter."""
"""Increment update counter."""
if
not
TurtleScreen
.
_RUNNING
:
if
not
TurtleScreen
.
_RUNNING
:
TurtleScreen
.
_RUNN
N
ING
=
True
TurtleScreen
.
_RUNNING
=
True
raise
Terminator
raise
Terminator
if
self
.
_tracing
>
0
:
if
self
.
_tracing
>
0
:
self
.
_updatecounter
+=
1
self
.
_updatecounter
+=
1
...
@@ -3754,7 +3754,7 @@ class _Screen(TurtleScreen):
...
@@ -3754,7 +3754,7 @@ class _Screen(TurtleScreen):
Turtle
.
_screen
=
None
Turtle
.
_screen
=
None
_Screen
.
_root
=
None
_Screen
.
_root
=
None
_Screen
.
_canvas
=
None
_Screen
.
_canvas
=
None
TurtleScreen
.
_RUNNING
=
Tru
e
TurtleScreen
.
_RUNNING
=
Fals
e
root
.
destroy
()
root
.
destroy
()
def
bye
(
self
):
def
bye
(
self
):
...
@@ -3795,7 +3795,6 @@ class _Screen(TurtleScreen):
...
@@ -3795,7 +3795,6 @@ class _Screen(TurtleScreen):
except
AttributeError
:
except
AttributeError
:
exit
(
0
)
exit
(
0
)
class
Turtle
(
RawTurtle
):
class
Turtle
(
RawTurtle
):
"""RawTurtle auto-creating (scrolled) canvas.
"""RawTurtle auto-creating (scrolled) canvas.
...
@@ -3818,18 +3817,6 @@ class Turtle(RawTurtle):
...
@@ -3818,18 +3817,6 @@ class Turtle(RawTurtle):
Pen
=
Turtle
Pen
=
Turtle
def
_getpen
():
"""Create the 'anonymous' turtle if not already present."""
if
Turtle
.
_pen
is
None
:
Turtle
.
_pen
=
Turtle
()
return
Turtle
.
_pen
def
_getscreen
():
"""Create a TurtleScreen if not already present."""
if
Turtle
.
_screen
is
None
:
Turtle
.
_screen
=
Screen
()
return
Turtle
.
_screen
def
write_docstringdict
(
filename
=
"turtle_docstringdict"
):
def
write_docstringdict
(
filename
=
"turtle_docstringdict"
):
"""Create and write docstring-dictionary to file.
"""Create and write docstring-dictionary to file.
...
@@ -3952,26 +3939,38 @@ def _screen_docrevise(docstr):
...
@@ -3952,26 +3939,38 @@ def _screen_docrevise(docstr):
## as functions. So we can enhance, change, add, delete methods to these
## as functions. So we can enhance, change, add, delete methods to these
## classes and do not need to change anything here.
## classes and do not need to change anything here.
__func_body
=
"""
\
def {name}{paramslist}:
if {obj} is None:
if not TurtleScreen._RUNNING:
TurtleScreen._RUNNING = True
raise Terminator
{obj} = {init}
try:
return {obj}.{name}{argslist}
except TK.TclError:
if not TurtleScreen._RUNNING:
TurtleScreen._RUNNING = True
raise Terminator
raise
"""
for
methodname
in
_tg_screen_functions
:
def
_make_global_funcs
(
functions
,
cls
,
obj
,
init
,
docrevise
):
pl1
,
pl2
=
getmethparlist
(
eval
(
'_Screen.'
+
methodname
))
for
methodname
in
functions
:
if
pl1
==
""
:
method
=
getattr
(
cls
,
methodname
)
print
(
">>>>>>"
,
pl1
,
pl2
)
pl1
,
pl2
=
getmethparlist
(
method
)
continue
if
pl1
==
""
:
defstr
=
(
"def
%(key)
s
%(pl1)
s: return _getscreen().
%(key)
s
%(pl2)
s"
%
print
(
">>>>>>"
,
pl1
,
pl2
)
{
'key'
:
methodname
,
'pl1'
:
pl1
,
'pl2'
:
pl2
})
continue
exec
(
defstr
)
defstr
=
__func_body
.
format
(
obj
=
obj
,
init
=
init
,
name
=
methodname
,
eval
(
methodname
)
.
__doc__
=
_screen_docrevise
(
eval
(
'_Screen.'
+
methodname
)
.
__doc__
)
paramslist
=
pl1
,
argslist
=
pl2
)
exec
(
defstr
,
globals
())
for
methodname
in
_tg_turtle_functions
:
globals
()[
methodname
]
.
__doc__
=
docrevise
(
method
.
__doc__
)
pl1
,
pl2
=
getmethparlist
(
eval
(
'Turtle.'
+
methodname
))
if
pl1
==
""
:
_make_global_funcs
(
_tg_screen_functions
,
_Screen
,
print
(
">>>>>>"
,
pl1
,
pl2
)
'Turtle._screen'
,
'Screen()'
,
_screen_docrevise
)
continue
_make_global_funcs
(
_tg_turtle_functions
,
Turtle
,
defstr
=
(
"def
%(key)
s
%(pl1)
s: return _getpen().
%(key)
s
%(pl2)
s"
%
'Turtle._pen'
,
'Turtle()'
,
_turtle_docrevise
)
{
'key'
:
methodname
,
'pl1'
:
pl1
,
'pl2'
:
pl2
})
exec
(
defstr
)
eval
(
methodname
)
.
__doc__
=
_turtle_docrevise
(
eval
(
'Turtle.'
+
methodname
)
.
__doc__
)
done
=
mainloop
done
=
mainloop
...
...
Lib/turtledemo/__main__.py
100755 → 100644
Dosyayı görüntüle @
4f38e483
...
@@ -344,6 +344,8 @@ class DemoWindow(object):
...
@@ -344,6 +344,8 @@ class DemoWindow(object):
else
:
else
:
self
.
state
=
DONE
self
.
state
=
DONE
except
turtle
.
Terminator
:
except
turtle
.
Terminator
:
if
self
.
root
is
None
:
return
self
.
state
=
DONE
self
.
state
=
DONE
result
=
"stopped!"
result
=
"stopped!"
if
self
.
state
==
DONE
:
if
self
.
state
==
DONE
:
...
@@ -369,7 +371,9 @@ class DemoWindow(object):
...
@@ -369,7 +371,9 @@ class DemoWindow(object):
turtle
.
TurtleScreen
.
_RUNNING
=
False
turtle
.
TurtleScreen
.
_RUNNING
=
False
def
_destroy
(
self
):
def
_destroy
(
self
):
turtle
.
TurtleScreen
.
_RUNNING
=
False
self
.
root
.
destroy
()
self
.
root
.
destroy
()
self
.
root
=
None
def
main
():
def
main
():
...
...
Misc/NEWS
Dosyayı görüntüle @
4f38e483
...
@@ -13,6 +13,9 @@ Core and Builtins
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #6639: Module-level turtle functions no longer raise TclError after
closing the window.
- Issues #814253, #9179: Group references and conditional group references now
- Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
work in lookbehind assertions in regular expressions.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment