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
f51531e2
Kaydet (Commit)
f51531e2
authored
Haz 22, 2014
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21823: Catch turtle.Terminator exceptions in turtledemo.
Add note to demohelp.txt about doing so.
üst
fabefc3c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
clock.py
Lib/turtledemo/clock.py
+6
-2
demohelp.txt
Lib/turtledemo/demohelp.txt
+9
-5
minimal_hanoi.py
Lib/turtledemo/minimal_hanoi.py
+4
-0
No files found.
Lib/turtledemo/clock.py
Dosyayı görüntüle @
f51531e2
...
@@ -11,6 +11,7 @@ and time
...
@@ -11,6 +11,7 @@ and time
------------------------------------
------------------------------------
"""
"""
from
turtle
import
*
from
turtle
import
*
from
turtle
import
Terminator
# not in __all__
from
datetime
import
datetime
from
datetime
import
datetime
mode
(
"logo"
)
mode
(
"logo"
)
...
@@ -102,7 +103,8 @@ def tick():
...
@@ -102,7 +103,8 @@ def tick():
sekunde
=
t
.
second
+
t
.
microsecond
*
0.000001
sekunde
=
t
.
second
+
t
.
microsecond
*
0.000001
minute
=
t
.
minute
+
sekunde
/
60.0
minute
=
t
.
minute
+
sekunde
/
60.0
stunde
=
t
.
hour
+
minute
/
60.0
stunde
=
t
.
hour
+
minute
/
60.0
tracer
(
False
)
try
:
tracer
(
False
)
# Terminator can occur here
writer
.
clear
()
writer
.
clear
()
writer
.
home
()
writer
.
home
()
writer
.
forward
(
65
)
writer
.
forward
(
65
)
...
@@ -113,11 +115,13 @@ def tick():
...
@@ -113,11 +115,13 @@ def tick():
align
=
"center"
,
font
=
(
"Courier"
,
14
,
"bold"
))
align
=
"center"
,
font
=
(
"Courier"
,
14
,
"bold"
))
writer
.
forward
(
85
)
writer
.
forward
(
85
)
tracer
(
True
)
tracer
(
True
)
second_hand
.
setheading
(
6
*
sekunde
)
second_hand
.
setheading
(
6
*
sekunde
)
# or here
minute_hand
.
setheading
(
6
*
minute
)
minute_hand
.
setheading
(
6
*
minute
)
hour_hand
.
setheading
(
30
*
stunde
)
hour_hand
.
setheading
(
30
*
stunde
)
tracer
(
True
)
tracer
(
True
)
ontimer
(
tick
,
100
)
ontimer
(
tick
,
100
)
except
Terminator
:
pass
# turtledemo user pressed STOP
def
main
():
def
main
():
tracer
(
False
)
tracer
(
False
)
...
...
Lib/turtledemo/demohelp.txt
Dosyayı görüntüle @
f51531e2
...
@@ -62,9 +62,13 @@
...
@@ -62,9 +62,13 @@
in the Label below the source code window (when execution
in the Label below the source code window (when execution
has finished.)
has finished.)
!! For programs, which are EVENT DRIVEN, main must return
If the demo is EVENT DRIVEN, main must return the string
!! the string "EVENTLOOP". This informs the viewer, that the
"EVENTLOOP". This informs the demo viewer that the script is
!! script is still running and must be stopped by the user!
still running and must be stopped by the user!
If an "EVENTLOOP" demo runs by itself, as with clock, which uses
ontimer, or minimal_hanoi, which loops by recursion, then the
code should catch the turtle.Terminator exception that will be
raised when the user presses the STOP button. (Paint is not such
a demo; it only acts in response to mouse clicks and movements.)
Lib/turtledemo/minimal_hanoi.py
Dosyayı görüntüle @
f51531e2
...
@@ -18,6 +18,7 @@ stretched to rectangles by shapesize()
...
@@ -18,6 +18,7 @@ stretched to rectangles by shapesize()
---------------------------------------
---------------------------------------
"""
"""
from
turtle
import
*
from
turtle
import
*
from
turtle
import
Terminator
# not in __all__
class
Disc
(
Turtle
):
class
Disc
(
Turtle
):
def
__init__
(
self
,
n
):
def
__init__
(
self
,
n
):
...
@@ -50,9 +51,12 @@ def hanoi(n, from_, with_, to_):
...
@@ -50,9 +51,12 @@ def hanoi(n, from_, with_, to_):
def
play
():
def
play
():
onkey
(
None
,
"space"
)
onkey
(
None
,
"space"
)
clear
()
clear
()
try
:
hanoi
(
6
,
t1
,
t2
,
t3
)
hanoi
(
6
,
t1
,
t2
,
t3
)
write
(
"press STOP button to exit"
,
write
(
"press STOP button to exit"
,
align
=
"center"
,
font
=
(
"Courier"
,
16
,
"bold"
))
align
=
"center"
,
font
=
(
"Courier"
,
16
,
"bold"
))
except
Terminator
:
pass
# turtledemo user pressed STOP
def
main
():
def
main
():
global
t1
,
t2
,
t3
global
t1
,
t2
,
t3
...
...
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