Picture of Python

Python for AndroidWelcome!

This is the second post about mobile development with Python. It’s a short tutorial, just to help you to understand and learn how to work with Python for Mobile. In this post you will see how to take pictures using Python and Android(Not compatible with iOS).

I – About the tutorials

(If you had read another tutorial, you can go to the topic III, because I and II is the same in all tutorials)

All my next posts will be about this tutorial series. I’ll show you how to use each mobile API, like compass, camera, sensors, sound, and others. After the API, we will start to test some Python libs, as PyGame and OpenCV. I’m using Android with buildozer, but some libs are compatible with iOS too(I’ll tell you when it’s compatible), so if you test it, send a feedback if possible.

In each post, I’ll show a sample app using on of them. When I finish all the tutorial, you will be able to develop almost any app with Python. In the principle, I’m not going to show the design stuff, but I recommend you to check Kivy and PySide. After finishing theses tutorials, maybe I can start a tutorial series about Kivy, for the design, but it’s easier to find at Google :)

You can check the Github repo here, and if you like it, please, star it :)

To be able to read all the tutorials, please follow my blog or subscribe your email to get updates. Another important thing if your feedback. I’m Brazilian and trying to write in English, so if you have any problem, please, just let me know. To make the tutorials better, try to comment always that is possible, showing your experiences, tips for a better tutorial, and this kind of stuff.

Before start, you can check this links to configure all the prerequisites:

II – Index

You will be able to get the links for all tutorials here, I’ll be updating when a new tutorial is published.

III – About this sample

Unfortunately Plyer camera still under development, so we will not be able to develop complex apps with it now. It’s only compatible with Android, and we are not able to get camera preview.

In this version, we can start the camera intent with the command take_picture and choose a place to save the photo. So the app will open the Android camera, take a picture, and if you need to, you can read this image when necessary.

To show you how to use this class, I’ll show a simple sample, when the user click in the screen, a new image will be taken. A label will show where the image was saved. So if you are using Kivy or PySide for the UI, you can get this link and show the image.

Let’s code!

IV – Creating our app

I’ll try to post a tutorial each two days. We are in the second tutorial, with basic examples, if you want to read all the tutorials, and at the end be able to develop any mobile app using Python, just follow my blog or subscribe you email to get updates. We are in the beginning posts, it’ll became more complex soon :)

Create a new folder and create a new file named main.py. Now, open your terminal and run the command bellow to create buildozer spec file.

$ buildozer init

Open your buildozer.spec and edit it. In this tutorial we are going to use Plyer, so make sure to have the following line:

requirements = kivy, plyer

You can check my version here:

[app] title = Python Camera package.name = camera package.domain = com.wordpress.bytedebugger source.dir = . source.include_exts = py, png, jpg, kv, atlas version = 1.0 requirements = kivy, plyer fullscreen = 1 [buildozer] log_level = 2






Monty Python and the Holy Grail Holy Hand Grenade Instructions Men's T-Shirt, Large
Apparel
  • Standard men s size tee
  • Front and back print design
  • Provides instructions for use of holy hand grenade
  • Officially licensed
Just A Flesh Wound -- Monty Python And The Holy Grail Adult T-Shirt, Large
Apparel
  • Officially licensed Monty Python And The Holy Grail product
  • Cool Just A Flesh Wound print
  • 100% cotton
  • Charcoal Gray
  • Available in adult, youth, and juniors styles/sizes


Related Posts