This example is another Votes showcase of how to use WAMP in a Kivy app by means of Autobahn|Python.
Below we will offer you the choice of running the this Kivy app in conjunction with a back-end component running either on your localhost or available on Tavendo's server.
See the Crossbar/Kivy example, or Kivy's web site.
Download the .dmg file from Kivy's download page and follow the instructions. You can safely skip the [section with instructions to install the developer's version] (http://kivy.org/docs/installation/installation-macosx.html#installing-the-dev-version)
A Votes back-end component is needed: in case there would not be any front-end Votes component running at all, the number of votes cast should still be kept.
The router decouples the components in your WAMP applications.
Use the python interpreter from Kivy to install crossbar within the virtualenv that Kivy is using:
<path_to_kivy>\python -m pip install crossbar
kivy -m pip install crossbar
Obtain the examples provided by crossbar:
git clone https://github.com/crossbario/crossbarexamples.git
Go to your crossbarexamples/votes/python folder and start the Crossbar router:
crossbar start
which will start up a python back-end Votes component as well.
Tavendo has got a Crossbar router and Votes back-end component running already. Easy!
Open your web browser and visit either
file:///crossbarexamples/votes/python/web/index.html
or http://127.0.0.1:8080
Open your Web browser and visit https://demo.crossbar.io/demo/votes/web:8080
.
This will open a javascript based Votes front-end component in your web browser.
Finally!
Clone the repository containing this example:
git clone https://github.com/rogererens/voteskivycrossbarclient.git
Go to the folder that contains this README.md file. If you are using a Mac
kivy -m pip install -r requirements-tavendo.txt
kivy main.py
other platforms should use
python -m pip install -r requirements-tavendo.txt
python main.py
where python is the python interpreter used by Kivy.
This will start a Kivy based UI which incorporates a Votes front-end component. It connects to the router and back-end on the Tavendo server.
If you would like to connect to your localhost based router and back-end, you have to discard the -tavendo
part
in the above command.
You now can send messages between the browser front-end and the Kivy front-end (in the latter, click the images to increase or reset the numbers):
There may be other people be using a Votes front-end component using the same public Crossbar.io server, so expect unexpected number of votes!
- Android availability in Google Play (an .apk is available on request, contact me (worrelsik) on #autobahn at IRC)
- iOS availability in Apple's App Store