AforAlex
Posts: 85
Joined: Thu May 31, 2012 7:56 pm

Any tutorials on how to make a simple Menu app in Python?

Mon Oct 05, 2015 7:36 pm

Hi, not sure if this is the right place to post, had a route through the other forums and a bit of a google search bit didn't find much so thought would be worth posting here, please let me know if you think I would be better posting else where.

I'm wanting to build a simple application that makes use of the lovely touch screen, ideally in Python that will essentially just be an area on the screen that shows some information, and then the user can tap 'ok' / 'Cancel' and maybe some kind of 'more info' button. I have a project in mind that will utilise a simple Mifare card reader, it will identify the card id, look up the owner from a mysql database and will then display some info returned. The user can then tap 'OK' , 'Cancel' or 'More Info'

I'm ok with all the card reader / mysql / python (except the touch screen interface bits)

Reading about I think my only option would perhaps be something using kivy (http://kivy.org/docs/installation/installation-rpi.html) ? and before I started I wondered whether there was a bit of help guide out there to get me started on my project or whether I will have to learn it from scratch.

Thanks in advanced

Alex

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Any tutorials on how to make a simple Menu app in Python

Wed Oct 07, 2015 12:58 pm

Kivy may be a good place to start for this.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

User avatar
MattRichardson
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 137
Joined: Sun Oct 07, 2012 3:39 pm
Location: San Francisco, CA
Contact: Website

Re: Any tutorials on how to make a simple Menu app in Python

Fri Oct 09, 2015 9:02 pm

I made this how-to that's specific to using Kivy with the official touch screen: https://github.com/mrichardson23/rpi-kivy-screen

lmoss30
Posts: 66
Joined: Mon May 28, 2012 11:45 am

Re: Any tutorials on how to make a simple Menu app in Python

Fri Oct 09, 2015 9:08 pm

Hi Matt,

Although I have posted elsewhere I have been trying to follow your guide and when I get to the download key section, I get a time out error to the server any thoughts

User avatar
MattRichardson
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 137
Joined: Sun Oct 07, 2012 3:39 pm
Location: San Francisco, CA
Contact: Website

Re: Any tutorials on how to make a simple Menu app in Python

Fri Oct 09, 2015 9:16 pm

lmoss30 wrote:Although I have posted elsewhere I have been trying to follow your guide and when I get to the download key section, I get a time out error to the server any thoughts
Yes, there used to be a note in the guide that said you just had to try it again if it doesn't work the first time around. I then updated the guide this morning to fix the issue entirely. Here's how to get it on the first try:
gpg --keyserver pgp.mit.edu --recv-keys 0C667A3E
Please report back and let me know if that works. I ran through the whole thing with Jessie this morning and everything still works mostly the same. I made a few tweaks to the guide.

AforAlex
Posts: 85
Joined: Thu May 31, 2012 7:56 pm

Re: Any tutorials on how to make a simple Menu app in Python

Fri Oct 09, 2015 9:18 pm

Thanks people, I suspected kivy was what I needed to use. Going to give it a proper go tomorrow,tjanks for the link on how to get but installed and set up.

Ta

lmoss30
Posts: 66
Joined: Mon May 28, 2012 11:45 am

Re: Any tutorials on how to make a simple Menu app in Python

Fri Oct 09, 2015 9:26 pm

cheers Matt, I will try tomorrow and see how it goes will let you know

lmoss30
Posts: 66
Joined: Mon May 28, 2012 11:45 am

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 5:01 pm

Successfully set using the new guide many thanks Matt

One question though what is the magic line to get the app to run on touch display

Managed to get the touch screen element working but couldn't see how to make the demo run on the screen

User avatar
MattRichardson
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 137
Joined: Sun Oct 07, 2012 3:39 pm
Location: San Francisco, CA
Contact: Website

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 6:16 pm

lmoss30 wrote:Successfully set using the new guide many thanks Matt
Glad to hear it!
lmoss30 wrote:One question though what is the magic line to get the app to run on touch display

Managed to get the touch screen element working but couldn't see how to make the demo run on the screen
Can you clarify? Are you saying that the interface appears on HDMI and not the display?

lmoss30
Posts: 66
Joined: Mon May 28, 2012 11:45 am

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 6:25 pm

I have a Motorola lapdock which I want to use as the primary display, I made this happen by changing the default display value in the config.txt file

I then want to develop the kivy app to run on the display if this is possible

User avatar
MattRichardson
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 137
Joined: Sun Oct 07, 2012 3:39 pm
Location: San Francisco, CA
Contact: Website

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 6:28 pm

Not totally sure, as I haven't done this myself. It may have to do with updating kivy's config.ini file to specify the display's framebuffer.

lmoss30
Posts: 66
Joined: Mon May 28, 2012 11:45 am

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 6:46 pm

The launch demo video Alex done had a set up running so I guess it a case of trawling through the info

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 9:23 pm

I'm having trouble when I get to this point. I've started over three times from the beginning and it always stops at the same place.

Code: Select all

sudo pip install cython pygments docutils
Collecting cython
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading Cython-0.23.4.tar.gz (1.6MB)
    100% |################################| 1.6MB 19kB/s
Collecting pygments
  Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
    100% |################################| 675kB 31kB/s
Collecting docutils
  Downloading docutils-0.12.tar.gz (1.6MB)
    100% |################################| 1.6MB 21kB/s
Building wheels for collected packages: cython, docutils
  Running setup.py bdist_wheel for cython
_
I've let it sit for an hour each time, I assume it shouldn't take any longer.

Before I started installing I updated/upgraded and made an image of the SD card. After it failed the first time I wrote the image back to the SD card to clear out everything from the first try, but that and the next round all quit at the same point again. Everything up to that point went fine and it uninstalled pip-1.1 and installed pip-7.1.2.
Any idea why it hangs when installing cython?

Code: Select all

uname -a
Linux rpi2 4.1.7+ #817 PREEMPT Sat Sep 19 15:25:36 BST 2015 armv6l GNU/Linux

User avatar
MattRichardson
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 137
Joined: Sun Oct 07, 2012 3:39 pm
Location: San Francisco, CA
Contact: Website

Re: Any tutorials on how to make a simple Menu app in Python

Sat Oct 10, 2015 10:00 pm

Not sure what the problem could be. Here's what I used to create the guide:
  • Raspberry Pi 2 Model B
  • 8gb micro SD
  • Fresh image of Raspbian written directly to the card. I've done it with the last Wheezy and the recent Jessie release. Haven't tried NOOBS, but no reason that wouldn't work that I can think of.
  • In raspi-config, I disabled boot to the X11 desktop, and I expanded the filesystem and rebooted before starting.
The Cython step does take a while, but no more than 15 minutes. Probably closer to 10.

lostcaggy
Posts: 7
Joined: Wed May 16, 2012 8:56 pm

Re: Any tutorials on how to make a simple Menu app in Python

Sun Oct 11, 2015 11:35 am

I had a similar problem with that step. Ran it a couple of times and it did eventually install but did take quite a while

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Any tutorials on how to make a simple Menu app in Python

Sun Oct 11, 2015 12:27 pm

I skipped the step installing pip 7.2 from source and used the pip 1.1 already installed.

Code: Select all

sudo pip install --upgrade cython
Cython install completed after that, so I installed "pygments" and "docutils"

Kivy installed without a problem and I've gone through the examples and demos and it's working great.

Kivy is really nice... and the pictures demo is a good example of multi-touch, pretty awesome. Now I just have to go through the example scripts and learn how to use it.

Return to “Official Foundation Display”