If you like my work, tip me!
]]>The plan is to add a new EGL Window provider, in addition to the detection of non-multitouch devices such as keyboard and mouse.
All the informations are available at: https://www.bountysource.com/#fundraisers/143-kivy-on-raspberry-pi
If you like my work, tip me!
]]>We found others libraries such as JPype or Py4j, but we weren’t happy with the design and the usability. Using Jython wasn’t an option either, because we wanted to use the library within our python for android project.
Let me show you how simple it is to use Pyjnius:
>>> from jnius import autoclass >>> Stack = autoclass('java.util.Stack') >>> stack = Stack() >>> stack.push('hello') >>> stack.push('world') >>> stack.pop() 'world' >>> stack.pop() 'hello'
What we demonstrate here is the autoclass function that create kind-of proxy that reflect all the methods and fields available from the Java class java.util.Stack.
Ok, maybe you want an Android-related example? Just have a look:
from jnius import autoclass from time import sleep MediaRecorder = autoclass('android.media.MediaRecorder') AudioSource = autoclass('android.media.MediaRecorder$AudioSource') OutputFormat = autoclass('android.media.MediaRecorder$OutputFormat') AudioEncoder = autoclass('android.media.MediaRecorder$AudioEncoder') # Record the Microphone with a 3GP recorder mRecorder = MediaRecorder() mRecorder.setAudioSource(AudioSource.MIC) mRecorder.setOutputFormat(OutputFormat.THREE_GPP) mRecorder.setOutputFile('/sdcard/testrecorder.3gp') mRecorder.setAudioEncoder(AudioEncoder.ARM_NB) mRecorder.prepare() # Record 5 seconds mRecorder.start() sleep(5) mRecorder.stop() mRecorder.release()
More examples are available in the documentation. We have a mapping between Java/Python type, native arrays, support for methods with multiple signatures, and a lot more. We are using Cython + JNI internally. The performance cost is minimal.
The library is already available for Python for android.
The library have been done by Gabriel Pettier and myself, under the Kivy organization.
If you like my work, tip me!
]]>The current instructions are available here: http://kivy.org/docs/guide/packaging-ios.html
For the full story on the multiple Apple limitations we are working with, i want to share the hardest part for Python integration: Apple’s prohibition on using dlopen() to load dynamic libraries.
In a typical case, a compiled Python library’s extension is a “.so”, and the “.so” is dlopen() at import.
That being said, as we did for the python-for-android project published in January, we are redirecting the compilation object to create static libraries. Theses libraries are included in the final application binary. But it’s not enough: we must also tell to Python to look for the library entry point in the application binary, instead of dlopen(). So in the python dynload loader:
return (dl_funcptr) dlsym(RTLD_MAIN_ONLY, funcname)
This way, Python will always look at the application binary, and never need to use dlopen().
If you are worried that Apple would reject a Python-based application, or even using Kivy altogether, we have tested it for you: the game that won the Kivy contest has been packaged for IOS, submitted to Apple… and accepted. You can found Deflectouch on iTunes (source code).
Anyway, Kivy is now officially supporting 5 platforms: Windows, Linux, MacOSX, Android and IOS!
Enjoy
If you like my work, tip me!
]]>Our winners are:
In term of numbers, everything is growing:
That was a great event so far, with a perfect timing: Kivy have now 1 year old! (first release was 1st February 2011).
If you like my work, tip me!
]]>https://github.com/kivy/python-for-android
The project is under the umbrella of Kivy organization, but is not designed to be limited to Kivy only. Read the documentation to correctly install the NDK/SDK Android, and set the needed environment variables.
The packaging is done in 4 steps:
1. Ensure you have Android SDK/NDK downloaded and correctly installed
2. Ensure you have some environment set
3. Create a Python distribution containing the selected modules
4. Use that distribution to build an APK of your Python application
Creating the python distribution is as simple as that:
# create a simple distribution with python + PIL + Kivy ./distribute.sh -m "pil kivy" # create a distribution with python + openssl + pil + kivy ./distribute.sh -m "openssl pil kivy"
A directory dist/default will be created, including the result of the whole arm compilation.
Available libraries as for today: jpeg pil png sdl sqlite3 pygame kivy android libxml2 libxslt lxml ffmpeg openssl.
The second step is a little bit harder, since you need to provide more information for Android:
cd dist/default ./build.py --package org.test.touchtracer --name touchtracer \ --version 1.0 --dir ~/code/kivy/examples/demo/touchtracer debug installd # --package: java name of your application # --name: title of your application # --version: version of your application # --dir: location of your application containing the main.py
Then you’ll get a nicely bin/touchtracer-1.0-debug.apk
Pro:
Cons:
I hope you’ll like it
We would like to thank Renpy / PGS4A for its initial pygame for android project
If you like my work, tip me!
]]>Kivy, an open source project for building cross platform applications and user interfaces, is announcing its 1st programming contest. The contest will start with the publication of official rules on January 1st. Registrations will be accepted through January 25th, and submissions will be accepted through January 31st. Prizes include Nvidia Tegra 2 android tablets from NotionInk, One-year “bronze” plans and t-shirts.
The goal of the contest is to encourage interested developers to learn more about Kivy, which is a cross platform Application and User Interface software library for the python programming language. Kivy applications run on Linux, Windows, OSX, Android (and iOS). The framework supports most inputs protocols and devices like WM_Touch, WM_Pen, Mac OS X Trackpad and Magic Mouse, single/multi touch screens, Mtdev, Linux Kernel HID, TUIO, and uses pure hardware accelerated rendering to enable developers to really take user interfaces to a new level.
The contest is sponsored by NotionInk, an indian company that designs tablets PCs, and Github, a web-based hosting service for software developments projects.
Join the contest at : http://kivy.org/#contest
If you like my work, tip me!
]]>
This release include:
A documentation translation project have been started (thanks for Sphinx for generating gettext translations automatically from python autodoc). Help us at: http://translation.kivy.org/.
And now, where to go ?
The roadmap is not written, since what we do is mostly depending of our interests / jobs / contributions.
But community is growing fast ! I see $N multistroke recognizer, GSOC integration (better macosx integration), iOS port, better android packaging, unit test, better desktop integration, widget theming support, 3D graphics instructions…
If you still hesitating about using Kivy… just look at the frontpage for the current awesome projects made by the community. And they are lot of others projects going to be released during the next month ! We are also glad to see some big companies to use Kivy as the base for building their products.
If you have also cool project going on, don’t hesitate to share
To finish, here is a video from Cyril that playing on Icarus Touch, an instrument that use Kivy for his UI. Awesome work !
If you like my work, tip me!
]]>
$ git push origin master
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_MESSAGES = "fr_FR.UTF-8",
LC_COLLATE = "fr_FR.UTF-8",
LC_CTYPE = "fr_FR.UTF-8",
LANG = "en_US.utf8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Everything up-to-date
You might want to check your /etc/ssh/sshd_config and look at the AcceptEnv token.
On this ssh server, it was:
# Allow client to pass locale environment variables AcceptEnv LANG LC_*
My locale environment was passed to the server, but the server doesn’t know about fr. Since i don’t want to install fr locales, just comment that line:
# Allow client to pass locale environment variables # AcceptEnv LANG LC_*
Done.
If you like my work, tip me!
]]>
We all care about cash, time, life, love, and if you’re doing computer graphics, you might care about the memory consumption of your graphics card. Why ? For the same reason when you running out of cash
I’ll explain why does it matter to compress texture, and compare available possibilities. My personnal goal is to be able to load a lot of FULL HD pictures on tablet, for a museum project. The analysis is focused on DXT1 compression and size. I’m looking forward to ETC1 and will update that blog post with the result in the future.
If you are doing an application that display lot of hd pictures, that’s matter. We’ll start from this simple math statement: a full HD picture is 1980×1020 with 4 channels (RGBA). Whatever if your pictures is in PNG, or JPEG, your graphics card is not able to understand it, and will store it in its memory decompressed. So this image will eat:
1920 x 1080 x 4 = 8294400 bytes = 7.91MB
1920 x 1080 x 4 + mipmaps = 10769252 bytes = 10.27MB
In theory. Because it might be more if your graphics card doesn’t support NPOT texture. If not, usually, the texture will be resized to the closest POT texture available, mean for us: 2048 x 2048. Then the size for POT will be:
2048 x 2048 x 4 = 16777216 bytes = 16MB
2048 x 2048 x 4 + mipmaps = 22369620 bytes = 21MB
They are plenty types of compression availables. The most common are S3TC (including DXT1, DXT3, DXT5) from Savage3 originally, LATC from Nvidia, PVRTC from PowerVR, ETC1 from Ericsson…
Not all of them are available everywhere, and it’s depending a lot from your hardware. Here is a list of tablet / vendor / texture compression available. (only tablet, not desktop computer.) Thanks to this stackoverflow thread about supported OpenGL ES 2.0 extensions on Android devices
| Tablette | Vendor | DXT1 | S3TC | LATC | PVRTC | ETC1 | 3DC | ATC |
|---|---|---|---|---|---|---|---|---|
| (desktop computer) GeForce GTX 560 | NVIDIA | X | X | X | ||||
| Motorola Xoom | NVIDIA | X | X | X | X | |||
| Nexus One | Qualcom | X | X | X | ||||
| Toshiba Folio | NVIDIA | X | X | X | X | |||
| LGE Tablet | NVIDIA | X | X | X | X | |||
| Galaxy Tab | PowerVR | X | X | |||||
| Acer Stream | Qualcomm | X | X | X | ||||
| Desire Z | Qualcomm | X | X | X | ||||
| Spica | Samsumg | X | X | |||||
| HTC Desire | Qualcomm | X | X | X | ||||
| VegaTab | NVIDIA | X | X | X | X | |||
| Nexus S | PowerVR | X | X | |||||
| HTC Desire HD | Qualcomm | X | X | X | ||||
| HTC Legend | Qualcomm | X | X | X | ||||
| Samsung Corby | Qualcomm | X | X | X | ||||
| Droid 2 | PowerVR | X | X | |||||
| Galaxy S | PowerVR | X | X | |||||
| Milestone | PowerVR | X | X |
We are seeing that ETC1 is standard compression for OpenGL ES 2, unfortunately, it will not work on desktop.
PVRTC is specific to PowerVR device: it’s a standard on Ipad/Iphone.
If you use DXT1, you need a POT image. DXT1 doesn’t work on NPOT.
To convert any image to DXT1 without any tool, you must know that your graphics card is capable of doing it, using specials opengl functions. But i wanted to precalculate them.
Nvidia texture tools contains tools for converting them, but you need an Nvidia card. For all others, you might want to look at Libsquish. It’s designed to compress in software a raw image to DXTn.
The result will be not a DXT1 “file”, because DXT1 is the compression format. The result will be stored in a DDS file, that we’ll see later about it.
If you want to be able to use libssquish in Python, you might want to apply my patch available on their issue tracker
For DXT1, the size of the file is not depending of the image content:
DXT1 2048x2048 RGBA = 2097152 bytes = 2MB
That’s already a big improvement. DXTn is able to store mipmaps of the texture too. For this size, the calculation is:
DXT1 2048x2048 RGBA + mipmap = 2795520 bytes = 2.73MB
| Type | Resolution | File size | GPU size | Images in a 256MB GPU | Images in a 512MB GPU |
|---|---|---|---|---|---|
| Raw RGBA image (POT) | 2048 x 2048 | - | 16384KB | 16 | 32 |
| PNG image (NPOT) | 1920 x 1080 | 4373KB | 8040KB | 32 | 65 |
| PNG Image in reduced POT resolution | 1024 x 1024 | 1268KB | 4096KB | 64 | 128 |
| DXT1 without mipmap | 2048 x 2048 | 2048KB | 2048KB | 128 | 256 |
| DXT1 without mipmap, reduced | 1024 x 1024 | 512KB | 512KB | 512 | 1024 |
| DXT1 with mipmap | 2048 x 2048 | 2730KB | 2730KB | 96 | 192 |
| DXT1 with mipmap, reduced | 1024 x 1024 | 682KB | 682KB | 384 | 768 |
As soon as we use compression, what we see is:
DXT1 itself is the compression format, but you cannot actually use it like that. You need to store the result is a formatted file. DDS.
Kivy is already able to read DDS files. But you must ensure that your graphics card is supporting DXT1 or S3TC. Look at gl_has_capability() function in Kivy then.
If you like my work, tip me!
]]>