■ 중/고급 : 참고용으로 제가 쓰려고 올려둡니다. 초보자를 위한 내용이 아닙니다.
■ 이 예제는 마우스로 3D 큐브 박스를 제어하는 예제입니다. 코드 정리와 필요한 노트는 추후. 핵심 사항만 먼저 올려둡니다. Py5 관련 이전 포스팅도 함께 참고하세요.
■ 다운로드 ( Portable Thonny IDE with py5 Download. 아래 코드는 이것으로 만들고 실행 테스트됨. )
☆☆☆ 다운로드 ☆☆☆
(아래 링크, 하단, 가장 큰 파일을 다운로드할 것. 대략 320MB Size.)
https://github.com/villares/thonny-portable-with-py5
https://github.com/villares/thonny-portable-with-py5/releases/tag/2025-06-11
■ 코드
''' 프로세싱 명령어들이 포함되어 있으며 프로세싱 홈페이지 혹은 프로세싱 교재들을 참고해야 합니다. 프로세싱 홈페이지나 Py5 홈페이지에는 자세하고 친절한 추가 정보들이 있습니다.
일단 코드만. '''
def setup():
size(500, 500, P3D)
translate(200, 200, 50)
rotate_y(0.5)
no_fill()
# box(100)
def draw():
background(200)
stroke(255, 50)
translate(200, 200, 70)
rotate_x(mouse_y*0.05)
rotate_y(mouse_x*0.05)
fill(mouse_x*2, 0, 160)
# sphere_detail(mouse_x//4)
# sphere(40)
# box(100)
box(100, 200, 50)
# pass
def mouse_clicked():
# fill(random_int(255), random_int(255), random_int(255))
# translate(200, 200, 20)
pass
run_sketch()
■ 참고 :
☆ 위에서 다운로드 받은 thonny-py5mode 0.4.7-alpha 포터블 버전이 있어야 함.
( 관련 정보 : https://github.com/tabreturn/thonny-py5mode )
☆ Portable Thonny > Menu > Py5(포터블 버전에는 이 메뉴가 새로 생겨남) Imported mode for py5 ] 항목에 체크하고 실행하시면 됩니다.
■ 파일
■ 참고 자료
1) https://py5coding.org/
2) https://github.com/tabreturn/thonny-py5mode
3) https://github.com/villares/thonny-portable-with-py5
4) https://processing.org/
즐거운 프로그래밍!
^.^;
'Programming > Python' 카테고리의 다른 글
Tkinter GUI와 함께 하는 파일 처리 연습 - 001 (0) | 2025.05.27 |
---|---|
문자열 함수 - 001 (0) | 2025.05.25 |
Color Picker 연습 - 001 (0) | 2025.05.22 |
프로세스의 실행과 종료하기 - Ex. 001 - calc.exe의 정체 (0) | 2025.05.22 |
Processing PythonMode Ex - 002 (0) | 2025.04.29 |