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
4c4300de
Kaydet (Commit)
4c4300de
authored
Tem 03, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reimplement turtle.circle using a polyline, to allow correct
filling of arcs. Also fixes #1514693.
üst
bd39c03c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
48 deletions
+17
-48
turtle.py
Lib/lib-tk/turtle.py
+14
-48
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/lib-tk/turtle.py
Dosyayı görüntüle @
4c4300de
...
@@ -344,7 +344,7 @@ class RawPen:
...
@@ -344,7 +344,7 @@ class RawPen:
"""
"""
self
.
fill
(
0
)
self
.
fill
(
0
)
def
circle
(
self
,
radius
,
extent
=
None
):
def
circle
(
self
,
radius
,
extent
=
None
):
""" Draw a circle with given radius.
""" Draw a circle with given radius.
The center is radius units left of the turtle; extent
The center is radius units left of the turtle; extent
determines which part of the circle is drawn. If not given,
determines which part of the circle is drawn. If not given,
...
@@ -360,53 +360,19 @@ class RawPen:
...
@@ -360,53 +360,19 @@ class RawPen:
>>> turtle.circle(120, 180) # half a circle
>>> turtle.circle(120, 180) # half a circle
"""
"""
if
extent
is
None
:
if
extent
is
None
:
extent
=
self
.
_fullcircle
extent
=
self
.
_fullcircle
x0
,
y0
=
self
.
_position
frac
=
abs
(
extent
)
/
self
.
_fullcircle
xc
=
x0
-
radius
*
sin
(
self
.
_angle
*
self
.
_invradian
)
steps
=
1
+
int
(
min
(
11
+
abs
(
radius
)
/
6.0
,
59.0
)
*
frac
)
yc
=
y0
-
radius
*
cos
(
self
.
_angle
*
self
.
_invradian
)
w
=
1.0
*
extent
/
steps
if
radius
>=
0.0
:
w2
=
0.5
*
w
start
=
self
.
_angle
-
(
self
.
_fullcircle
/
4.0
)
l
=
2.0
*
radius
*
sin
(
w2
*
self
.
_invradian
)
else
:
if
radius
<
0
:
start
=
self
.
_angle
+
(
self
.
_fullcircle
/
4.0
)
l
,
w
,
w2
=
-
l
,
-
w
,
-
w2
extent
=
-
extent
self
.
left
(
w2
)
if
self
.
_filling
:
for
i
in
range
(
steps
):
if
abs
(
extent
)
>=
self
.
_fullcircle
:
self
.
forward
(
l
)
item
=
self
.
_canvas
.
create_oval
(
xc
-
radius
,
yc
-
radius
,
self
.
left
(
w
)
xc
+
radius
,
yc
+
radius
,
self
.
right
(
w2
)
width
=
self
.
_width
,
outline
=
""
)
self
.
_tofill
.
append
(
item
)
item
=
self
.
_canvas
.
create_arc
(
xc
-
radius
,
yc
-
radius
,
xc
+
radius
,
yc
+
radius
,
style
=
"chord"
,
start
=
start
,
extent
=
extent
,
width
=
self
.
_width
,
outline
=
""
)
self
.
_tofill
.
append
(
item
)
if
self
.
_drawing
:
if
abs
(
extent
)
>=
self
.
_fullcircle
:
item
=
self
.
_canvas
.
create_oval
(
xc
-
radius
,
yc
-
radius
,
xc
+
radius
,
yc
+
radius
,
width
=
self
.
_width
,
outline
=
self
.
_color
)
self
.
_items
.
append
(
item
)
item
=
self
.
_canvas
.
create_arc
(
xc
-
radius
,
yc
-
radius
,
xc
+
radius
,
yc
+
radius
,
style
=
"arc"
,
start
=
start
,
extent
=
extent
,
width
=
self
.
_width
,
outline
=
self
.
_color
)
self
.
_items
.
append
(
item
)
angle
=
start
+
extent
x1
=
xc
+
abs
(
radius
)
*
cos
(
angle
*
self
.
_invradian
)
y1
=
yc
-
abs
(
radius
)
*
sin
(
angle
*
self
.
_invradian
)
self
.
_angle
=
(
self
.
_angle
+
extent
)
%
self
.
_fullcircle
self
.
_position
=
x1
,
y1
if
self
.
_filling
:
self
.
_path
.
append
(
self
.
_position
)
self
.
_draw_turtle
()
def
heading
(
self
):
def
heading
(
self
):
""" Return the turtle's current heading.
""" Return the turtle's current heading.
...
...
Misc/NEWS
Dosyayı görüntüle @
4c4300de
...
@@ -19,6 +19,9 @@ Core and builtins
...
@@ -19,6 +19,9 @@ Core and builtins
Library
Library
-------
-------
- Reimplement turtle.circle using a polyline, to allow correct
filling of arcs. Also fixes #1514693.
- Bug #1514703: Only setup canvas window in turtle when the canvas
- Bug #1514703: Only setup canvas window in turtle when the canvas
is created.
is created.
...
...
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