# 10.ภูเขาดวงอาทิตย์

{% code lineNumbers="true" fullWidth="true" %}

```python
from turtle import *  # นำเข้าโมดูล turtle เพื่อใช้สำหรับการวาดรูปกราฟิก
def mountain(x,y,s):  # กำหนดฟังก์ชัน mountain ที่รับพารามิเตอร์ x, y, และ s เพื่อวาดภูเขา
    pu()  # ยกปากกาขึ้น (ไม่วาดขณะเคลื่อนที่)
    goto(x,y)  # เคลื่อนที่ไปยังตำแหน่ง (x, y) ที่กำหนด
    pd()  # วางปากกาลง (เริ่มวาดขณะเคลื่อนที่)
    color('green')  # ตั้งค่าสีของปากกาและการเติมเป็นสีเขียว
    begin_fill()  # เริ่มการเติมสีภายในรูปทรง
    for i in range(3):  # เริ่มลูปเพื่อวาดรูปสามเหลี่ยม (ลูป 3 ครั้งสำหรับ 3 ด้านของสามเหลี่ยม)
        fd(100*s)  # เคลื่อนที่ไปข้างหน้าตามระยะทาง 100 หน่วย คูณด้วยสเกล s
        lt(120)  # หมุนกระดองเต่าไปทางซ้าย 120 องศา เพื่อสร้างมุมของสามเหลี่ยม
    end_fill()  # สิ้นสุดการเติมสีภายในรูปทรง
    
def sun(x,y,s):  # กำหนดฟังก์ชัน sun ที่รับพารามิเตอร์ x, y, และ s เพื่อวาดดวงอาทิตย์
    pu()  # ยกปากกาขึ้น (ไม่วาดขณะเคลื่อนที่)
    goto(x,y)  # เคลื่อนที่ไปยังตำแหน่ง (x, y) ที่กำหนด
    pd()  # วางปากกาลง (เริ่มวาดขณะเคลื่อนที่)
    color('red')  # ตั้งค่าสีของปากกาและการเติมเป็นสีแดง
    begin_fill()  # เริ่มการเติมสีภายในรูปทรง
    circle(s*20)  # วาดวงกลมโดยมีรัศมีเป็น 20 หน่วย คูณด้วยสเกล s
    end_fill()  # สิ้นสุดการเติมสีภายในรูปทรง
mountain(-400,-200,4)  # เรียกใช้ฟังก์ชัน mountain เพื่อวาดภูเขาแรกที่ตำแหน่ง (-400, -200) ด้วยสเกล 4
mountain(-200,-200,5)  # เรียกใช้ฟังก์ชัน mountain เพื่อวาดภูเขาที่สองที่ตำแหน่ง (-200, -200) ด้วยสเกล 5
mountain(100,-200,3)  # เรียกใช้ฟังก์ชัน mountain เพื่อวาดภูเขาที่สามที่ตำแหน่ง (100, -200) ด้วยสเกล 3
sun(-100,250,3)  # เรียกใช้ฟังก์ชัน sun เพื่อวาดดวงอาทิตย์ที่ตำแหน่ง (-100, 250) ด้วยสเกล 3
mainloop()  # เริ่มลูปหลักเพื่อรักษาหน้าจอให้แสดงผลจนกว่าผู้ใช้จะปิดหน้าจอ
```

{% endcode %}

<figure><img src="https://1059722861-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWAMRQLhtfzfy8yv80Se5%2Fuploads%2Frtr1zckd66nBVld1OFce%2F1-5.png?alt=media&#x26;token=bdeced19-71f0-4864-8604-bb897b115d0d" 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/10..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.
