MapleStory Finger Point

๐Ÿ’Ž Python/Python_Code

ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ - ํŒŒ์ด์ฌ for Beginner (2ํŒ)

HYEJU01 2024. 3. 18. 16:40

 

โœ… ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ (๊ธฐ๋ณธ)

import turtle  ##ํ„ฐํ‹€๊ทธ๋ž˜ํ”ฝ์‚ฌ์šฉ์„์œ„ํ•œ์‚ฝ์ž…##

##ํ•จ์ˆ˜ ์„ ์–ธ##

##๋ณ€์ˆ˜ ์„ ์–ธ##
myT=None  ##์•„๋ฌด๊ฒƒ๋„์—†๋‹ค๋Š” None ์œผ๋กœ ์ดˆ๊ธฐํ™”##
 
##๋ฉ”์ธ ์ฝ”๋“œ##
myT=turtle.Turtle()  ##myT ๋กœ ํ„ฐํ‹€ ๋Œ€์ž…##
myT.shape('turtle')  ##๊ฑฐ๋ถ์ด ๋ชจ์–‘ 7๊ฐ€์ง€##


for i in range(0,4) :
    myT.forward(200) ##๊ฑฐ๋ถ์ด๋ฅผ ์•ž์œผ๋กœ ์ด๋™##
    myT.right(90) ##๊ฑฐ๋ถ์ด๋ฅผ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ํšŒ์ „##


turtle.done()


โœ… ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ (์‘์šฉ)

1. ์™ผ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„ ์„ ๊ทธ๋ฆผ 

2. ์Šคํฌ๋กค ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด ํ™•๋Œ€/์ถ•์†Œ (์ƒ‰๋ณ€๊ฒฝ)

3. ์˜ค๋ฅธ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„  ๊ทธ๋ฆฌ์ง€ ์•Š๊ณ  ์ด๋™๋งŒํ•จ

import turtle
import random

##ํ•จ์ˆ˜ ์„ ์–ธ##
def screenLeftClick(x,y) :
    global r,g,b
    turtle.pencolor((r,g,b))
    turtle.pendown()
    turtle.goto(x,y)
def screenRightClick(x,y) :
    turtle.penup()
    turtle.goto(x,y)

def screenMidClick(x,y) :
    global r,g,b
    tSize = random.randrange(1,10)
    turtle.shapesize(tSize)
    r=random.random()
    g=random.random()
    b=random.random()
    
##๋ณ€์ˆ˜ ์„ ์–ธ##
pSize= 10
r,g,b = 0.0,0.0,0.0

##๋ฉ”์ธ ์ฝ”๋“œ##

turtle.title('๊ฑฐ๋ถ๊ฑฐ๋ถ ๊ทธ๋ฆผ๊ทธ๋ฆฌ๊ธฐ')
turtle.shape('turtle')
turtle.pensize(pSize)

turtle.onscreenclick(screenLeftClick, 1)
turtle.onscreenclick(screenRightClick, 3)
turtle.onscreenclick(screenMidClick, 2)


turtle.done()


 

 

โœ… ํ„ฐํ‹€ ๊ทธ๋ž˜ํ”ฝ ํ”„๋กœ๊ทธ๋žจ (์‘์šฉ)

1. ์™ผ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„ ์„ ๊ทธ๋ฆผ + ํ™•๋Œ€ ์ถ•์†Œ (์ƒ‰๋ณ€๊ฒฝ)

3. ์˜ค๋ฅธ์ชฝ ๋งˆ์šฐ์Šค : ๊ฑฐ๋ถ์ด๊ฐ€ ์„  ๊ทธ๋ฆฌ์ง€ ์•Š๊ณ  ์ด๋™๋งŒํ•จ

 

import turtle
import random

##ํ•จ์ˆ˜ ์„ ์–ธ##
def screenLeftClick(x,y) :
    global r,g,b
    turtle.pencolor((r,g,b))
    turtle.pendown()
    turtle.goto(x,y)
    tSize = random.randrange(1,10)
    turtle.shapesize(tSize)
    r=random.random()
    g=random.random()
    b=random.random()
def screenRightClick(x,y) :
    turtle.penup()
    turtle.goto(x,y)


    
##๋ณ€์ˆ˜ ์„ ์–ธ##
pSize= 10
r,g,b = 0.0,0.0,0.0

##๋ฉ”์ธ ์ฝ”๋“œ##

turtle.title('๊ฑฐ๋ถ๊ฑฐ๋ถ ๊ทธ๋ฆผ๊ทธ๋ฆฌ๊ธฐ')
turtle.shape('turtle')
turtle.pensize(pSize)

turtle.onscreenclick(screenLeftClick, 1)
turtle.onscreenclick(screenRightClick, 3)


turtle.done()