# 18.รูป 6 เหลี่ยม 4 รูปซ้อน

<pre class="language-python"><code class="lang-python">// Some code
import turtle	        #นำเข้าโมดูล turtle เพื่อใช้ในการวาดกราฟิก
t = turtle.Turtle()	#สร้างวัตถุเต่า (turtle) ชื่อ t สำหรับใช้ในการวาดกราฟิก
t.shape('turtle')	#กำหนดรูปร่างของวัตถุ t ให้เป็นรูปเต่า
t.color('blue')	        #กำหนดสีของปากกาที่วัตถุ t ใช้เป็นสีน้ำเงิน
t.width(2)	        #กำหนดความหนาของเส้นที่วาดโดย t เป็น 2 หน่วย
for _ in range(4):	#วนซ้ำ 4 ครั้งเพื่อสร้างรูปแบบที่ประกอบไปด้วย 4 ส่วน
<strong>    for _ in range(6):	#วนซ้ำ 6 ครั้งภายในแต่ละส่วนเพื่อวาดหกเหลี่ยม (hexagon)
</strong>        t.fd(60)	#วาดเส้นตรงไปข้างหน้าระยะ 60 หน่วย
        t.rt(60)	#หมุนหัวปากกาทางขวา 60 องศา (ใช้ในแต่ละด้านของหกเหลี่ยม)
    t.rt(90)	        #หลังจากวาดหกเหลี่ยมเสร็จ หมุนหัวปากกาทางขวา 90 องศาเพื่อเริ่มวาดหกเหลี่ยมถัดไป
turtle.exitonclick()	#ปิดหน้าต่างกราฟิกเมื่อคลิกเมาส์บนหน้าจอ
</code></pre>

<figure><img src="https://1059722861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWAMRQLhtfzfy8yv80Se5%2Fuploads%2F5ipqgUnSRYkso4UJ2CeR%2F8-1.png?alt=media&#x26;token=b06e1253-8421-4f51-a9db-47669399d8a2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1059722861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWAMRQLhtfzfy8yv80Se5%2Fuploads%2FUDgUOXDfwWknOB8wIb8J%2F8.png?alt=media&#x26;token=cb0238c9-2b33-4be3-a65c-a2ae459fe229" 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/2.example11-20/18.-6-4.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.
