Kivy

Sound volume issues when using kivy on Debian with gnome and pulse audio fixed

0

When using kivy on a Debian system running pulse audio (gnome) you would encounter issues with the sound volume due to the fact that kivy would set the volume to 100% each time it uses the soundcard.
The problem is in pulse audio, what’s new 🙁 as it’s the from the same author who brings us systemd.
You can remove pulse audio as much of gnome depends on it.
You can however disable pulse and use good old alsa.

Disable pulse in /etc/pulse/client.conf uncomment the line “autospawn = yes” and set it to “autospawn = no”
Install gnome alsa mixer, sudo apt-get install gnome-alsamixer
Restart alsa, sudo alsa force-reload
Or use alsamixer (console) to control the volumes.

Tried to use key shortcuts in gnome but that doesn’t work correctly.
Just use trusted xbindkeysrc always works 🙂

install xbindkeys, sudo apt-get install xbindkeys
Use this .xbindkeysrc file and your done (after logout and login)

#Alsa Volume Down
"amixer set Master 3- unmute"
   XF86AudioLowerVolume

#Alsa Volume Up
 "amixer set Master 3%+ unmute"
 XF86AudioRaiseVolume

#Alsa mute/unmute toggel
 "amixer sset Master toggle"
 XF86AudioMute

ogg not playing on Kivy when packaged with pyinstaller

0

I’m working to package a Kivy based project for Windows7 by using pyinstaller and while following
the Kivy manual I noticed that all went well except for the ogg sound files I’m using.
The only thing one would notice when running the “exe” is that when playing the ogg you
would only hear a “click” iso the ogg sound file.
The solution  was to include by hand the the following DLL’s from site-packages/pygame:
libogg.dll, libvorbis.dll and libvorbisfile.dll to th eroot of the “exe” tree.

Syntax highlighting for Kivy kv language in pycharm

10

The nice folks on the Kivy ML have provided a kv language highlighting for Pycharm 🙂

For easy retrieval I just post the original announcement together with the settings file:

For anyone using PyCharm, please find attached a file type extension that give you full syntax highlighting for KV files. Courtesy of Xuton…;-)
To install:
On Pycharm’s main menu, click File-> Import settings

    Select this file, then it will come with a dialog with filetypes ticked. Just click ok or whatever and then its there.

You can get the file here:

https://github.com/Zen-CODE/kivybits/blob/master/IDE/PyCharm_kv_completion.jar

 

Kivy on android https support. Part2

0

I still was unable to connect to http(s) from an android device and after some test cases with simple xmlrpc server/clients I noticed I’ve got socket errors claiming that I have no permission to use sockets.
So the real fix was to build the package with “–permission INTERNET”.
Now I have proper http(s) support 🙂

Building a kivy app for Android issues

0

When making a kivy app for Android I came across some issues and while I informed the kivy devs I just put them here also just in case I need them later 🙂

Just follow the manual for packaging for Android.
First of all when you install the dependencies you must use python-pip iso pip.
When building the python binary I had problems with the httplib module which did have https support.
This what adb logcat told me:
I/python (19347): your version of httplib doesn’t support HTTPS

As it turned out the order in which you build the various modules matter.
So when building the Python binary you must use the order.
Put C lib first, then python lib, then kivy.
eg ./distribute.sh -m “sqlite3 libxml2 pyopenssl pil kivy”

Now there’s HTTPS support.

When you still haven’t HTTPS support try to clean the python4android git tree.
git clean -dxf

More android specific stuff I encountered:
To write to the filesystem use CWD/.kivy/….
sys.platform is on android ‘linux3’ (GNU/Linux is ‘linux2’)

kv language designing with anchorlayout

0

When designing a Kivy menu with the kv language I run into troubles with the anchorlayout object.
It seems that you need to put every object inside a achorlayout which itself is part of a anchorlayout.

Sounds a bit vague so an example should do:

[sourcecode language=”text”]
<topbox>:
AnchorLayout:
id: topmenu
anchor_x: ‘center’
anchor_y: ‘top’

BoxLayout:
orientation: ‘horizontal’
AnchorLayout:
anchor_x: ‘left’
anchor_y: ‘top’
padding: 8
Button:
id: infobutton
size: (48, 48)
size_hint: None, None
background_normal: ‘info_button.png’
background_down: ‘info_button.png’
on_press: root.on_button_clicked("info")

AnchorLayout:
anchor_x: ‘center’
anchor_y: ‘top’
padding: 8
BoxLayout:
padding: 0
spacing: 4
size: (300, 48)
size_hint: None, None
orientation: ‘horizontal’
AnchorLayout:
anchor_x: ‘center’
anchor_y: ‘top’
Button:
size: (48, 48)
size_hint: None, None
background_normal: ‘star1.png’
on_press: root.on_button_clicked("star1")
AnchorLayout:
anchor_x: ‘center’
anchor_y: ‘top’
Button:
size: (48, 48)
size_hint: None, None
background_normal: ‘star1.png’
on_press: root.on_button_clicked("star2")
AnchorLayout:
anchor_x: ‘right’
anchor_y: ‘top’
padding: 8
Button:
id: quitbutton
size: (48, 48)
size_hint: None, None
background_normal: ‘quit_button.png’
background_down: ‘quit_button_ro.png’
on_press: root.on_quit_button_clicked()

[/sourcecode]

Go to Top