Kivy 시작하기 14.05 (모바일 앱 만들기 5)
사용 버전: Python 3.7.6, Kivy 1.11.1
사용 프로그램: Atom 1.43.0 x64
운영체제: 페도라 31 Workstation x64, Android 9 Pie
저장 경로를 바꾸기 위해서 수정을 해보겠습니다.
Python에서 Android Java 기능을 사용하기 위해 pyjnius를 설치합니다.
https://pyjnius.readthedocs.io/en/stable/installation.html
python -m pip install pyjnius

모듈을 사용합니다.

autoclass 안에는 API가 들어갑니다.
https://developer.android.com/reference/packages

휴대폰 App의 Activity와 Context를 Python에 연결합니다.

그리고 처음 경로를 DCIM으로 설정하도록 새로운 클래스를 하나 만들어 줍니다.


getExternalFilesDir은 Context의 Method로 File 형식을 반환합니다.
toString은 File의 Method입니다. String을 반환합니다.


그리고 Save_path를 Image_path로 만들어줍니다.

새로운 함수를 만들어줍니다.

filechooser 경로를 Image_path로 맞춰줍니다.

kv 파일의 Location Popup에 해당 함수를 실행합니다.

다시 빌드 합니다.

--window 옵션을 추가해주었습니다.
이는 원래 휴대폰의 상태 바가 사라지는 것을 방지해줍니다.
--requirements에 pyjnius를 추가했습니다.
DCIM이 잘 잡히는 걸로 보아 제대로 된 것 같습니다.
다른 문제가 발생했는데요.
저장한 사진이 보이지 않습니다.
https://youtu.be/wx1kHmHYnJg
다음 시간에는 사진첩에 보이지 않는 문제를 해결해보겠습니다.
끝.
앱:
https://play.google.com/store/apps/details?id=starlight.jaehwa.one
코드:
https://github.com/shwoghk14/Kivy_for_Starter
사용 프로그램: Atom 1.43.0 x64
운영체제: 페도라 31 Workstation x64, Android 9 Pie
기획: URL 소스 자료를 내 휴대폰에 저장하는 앱.
저장 경로를 바꾸기 위해서 수정을 해보겠습니다.
Python에서 Android Java 기능을 사용하기 위해 pyjnius를 설치합니다.
https://pyjnius.readthedocs.io/en/stable/installation.html
python -m pip install pyjnius

모듈을 사용합니다.

autoclass 안에는 API가 들어갑니다.
https://developer.android.com/reference/packages

휴대폰 App의 Activity와 Context를 Python에 연결합니다.

그리고 처음 경로를 DCIM으로 설정하도록 새로운 클래스를 하나 만들어 줍니다.


getExternalFilesDir은 Context의 Method로 File 형식을 반환합니다.
toString은 File의 Method입니다. String을 반환합니다.


그리고 Save_path를 Image_path로 만들어줍니다.

새로운 함수를 만들어줍니다.

filechooser 경로를 Image_path로 맞춰줍니다.

kv 파일의 Location Popup에 해당 함수를 실행합니다.

다시 빌드 합니다.

--window 옵션을 추가해주었습니다.
이는 원래 휴대폰의 상태 바가 사라지는 것을 방지해줍니다.
--requirements에 pyjnius를 추가했습니다.
DCIM이 잘 잡히는 걸로 보아 제대로 된 것 같습니다.
다른 문제가 발생했는데요.
저장한 사진이 보이지 않습니다.
https://youtu.be/wx1kHmHYnJg
다음 시간에는 사진첩에 보이지 않는 문제를 해결해보겠습니다.
끝.
앱:
https://play.google.com/store/apps/details?id=starlight.jaehwa.one
코드:
https://github.com/shwoghk14/Kivy_for_Starter
카테고리: BlackSmith, Kivy
댓글
댓글 쓰기
궁금한 점은 댓글 달아주세요.
Comment if you have any questions.