# 05.วาดรูปดอกไม้หกกลีบ

```python
import turtle

# ตั้งค่าเต่า
t = turtle.Turtle('turtle')  # ใช้เต่ารูปเต่า
t.speed(10)                  # กำหนดความเร็วของเต่า
turtle.bgcolor("white")      # ตั้งสีพื้นหลังเป็นสีขาว

# ฟังก์ชันวาดกลีบดอกไม้
def draw_petal():
    t.color("red")      # ตั้งสีของกลีบดอกไม้เป็นสีแดง
    t.begin_fill()      # เริ่มต้นการเติมสี
    t.circle(100, 60)   # วาดเส้นโค้งของกลีบดอกไม้
    t.left(120)         # หมุนเต่าไปทางซ้าย 120 องศา
    t.circle(100, 60)   # วาดเส้นโค้งของกลีบดอกไม้อีกด้าน
    t.end_fill()        # จบการเติมสี

# วาดดอกไม้ด้วยกลีบดอกไม้หลายกลีบ
for i in range(6):     # ทำซ้ำ 6 ครั้ง
    draw_petal()       # เรียกใช้ฟังก์ชันวาดกลีบดอกไม้
    t.left(60)         # หมุนเต่าไปทางซ้าย 60 องศาเพื่อวางกลีบถัดไป

# วาดศูนย์กลางของดอกไม้
t.color("yellow")  # ตั้งสีของศูนย์กลางดอกไม้เป็นสีเหลือง
t.penup()  # ยกปากกาเพื่อไม่ให้มีเส้นขณะเคลื่อนที่
t.goto(0, -50)  # เคลื่อนเต่าไปที่ตำแหน่ง (0, -50)
t.pendown()  # วางปากกาลงเพื่อเริ่มวาด
t.begin_fill()  # เริ่มเติมสี
t.circle(50)  # วาดวงกลมขนาดรัศมี 50
t.end_fill()  # จบการเติมสี

# ซ่อนเต่าและแสดงหน้าต่าง
t.hideturtle()  # ซ่อนเต่าเมื่อวาดเสร็จ
turtle.done()  # จบการวาดและรอให้ปิดหน้าต่างด้วยมือ

```

<figure><img src="https://1059722861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWAMRQLhtfzfy8yv80Se5%2Fuploads%2FX2TyfI9aQrxZgEnP3FKS%2Fexam05.png?alt=media&#x26;token=483b87c6-862c-45b6-8da4-8b229a9a308e" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://krootee.gitbook.io/python-turtle/1.example01-10/05..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
