python

ยทpython
๋ฐฉ๋ฒ• 1 - Clear Previous Output option vscode ์‚ฌ์šฉ์‹œ code runner extension์„ ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ํŒŒ์ผ์„ ๋ฐ˜๋ณต์ ์œผ๋กœ ์‹คํ–‰ํ•˜๋‹ค ๋ณด๋ฉด ํ„ฐ๋ฏธ๋„์ด ์ง€์ €๋ถ„ํ•˜๊ณ  ๋ณต์žกํ•ด์ ธ์„œ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ์ด๋Ÿด ๋•Œ ํŒŒ์ผ์„ ์‹คํ–‰ํ•  ๋•Œ ๋งˆ๋‹ค ํ„ฐ๋ฏธ๋„์„ ์ดˆ๊ธฐํ™”ํ•˜๋Š” ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋ฐฉ๋ฒ•์ผ ์ˆ˜ ์žˆ๋‹ค. 1. vscode ์„ค์ •์œผ๋กœ ๊ฐ„๋‹ค (โŒ˜ + ,) 2. ๊ฒ€์ƒ‰์ฐฝ์— 'Clear Previous Output'์„ ์ž…๋ ฅํ•œ๋‹ค 3. Code-runner: Clear Previous Output ๋ฐ•์Šค๋ฅผ ์ฒดํฌํ•œ๋‹ค. ์ฒดํฌ ์™„๋ฃŒ ํ›„, ํŒŒ์ผ์„ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ธฐ์กด ํ„ฐ๋ฏธ๋„์ด ์ดˆ๊ธฐํ™”๋œ ์ดํ›„์— ์ถœ๋ ฅ๋œ๋‹ค. ๋ฐฉ๋ฒ• 2 - settings.json ์ˆ˜์ • ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ์ฐพ์•˜๋‹ค. ์ด ๋ฐฉ๋ฒ•์€ ์ถœ๋ ฅ ์‹œ outp..
ยทpython
Turtle graphics Module์„ ์‚ฌ์šฉํ•ด์„œ ๋ฑ€ ๊ฒŒ์ž„์„ ๋งŒ๋“ค์–ด๋ณด์ž. ๋จน์ด๋ฅผ ๋จน์œผ๋ฉด ๊ผฌ๋ฆฌ๊ฐ€ ํ•œ ์นธ์”ฉ ์ž๋ผ๊ณ , ๊ผฌ๋ฆฌ๋‚˜ ์ฐฝ ๋์— ๋ถ€๋”ชํžˆ๋ฉด ์ฃฝ๋Š” ๊ฒŒ์ž„์ด๋‹ค. main.py, snake.py, scoreBoard.py, food.py ์ด 4๊ฐ€์ง€ ํŒŒ์ผ๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค. # main.py import time from turtle import Screen, Turtle from snake import Snake from food import Food from scoreBoard import ScoreBoard screen = Screen() screen.setup(width=600, height=600) screen.bgcolor("black") screen.title("Snake Game") screen.tr..
Chan Lee
'python' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)