-1

I have a project I want to do, and I got an SPI touch screen (tontec 3.5") for it. I want to start up into some sort of GUI application. I only have roughly 950mb left on my micro SD (8gb, install takes all). I want to know how I can do this, with the least heavy memory taking way possible (no, I am not looking for Kiosk mode with chromium.) and (possibly) some way of a canvas (such as, draw single pixel here; line from X,X to X,X; circle around X,X at radius of X... ect). I have learned some python before, but I could not get a tkinter based GUI to even run from the command line. (I am willing to learn a new programming language if required.)

3
  • 3
    Create the application first, worry about starting it from boot later.
    – goldilocks
    Commented Aug 22, 2015 at 17:50
  • What should I use to create the application, and run the fastest(I am going to be making a clock, and I want to use some animations. Not graphical, and limited to maybe 5 colors or less)(and I would like to disable keyboard and mouse interactions too, leaving just GPIO; Not sure if that will make things even better) Commented Aug 22, 2015 at 21:32

4 Answers 4

0

With regard to creating the application:

I am going to be making a clock, and I want to use some animations. Not graphical, and limited to maybe 5 colors

There are two categories you can consider here. The first is TUI applications, which on a GNU/Linux system are usually implemented with a library called ncurses. There will be a python interface to that. The wikipedia article contains enough screenshots to give you some idea of what is possible with that.

The other category are full blown GUI apps. These do not have to be much more complicated to create than TUI apps,1 so unless you are certain ncurses is sufficient, you probably want to go this route. There are a number of different GUI libraries in common use on linux, the primary two being GTK+ and Qt. Both of these also have python bindings and can be used to create a typical modern GUI app. The former is probably more memory efficient in a Raspbian context.

There is also Tk, which has a bit more of an "old school" look -- if you google for "Tk widgets" and check out the images you'll get the idea. It can be made to look pretty funky; the main drawback visually is that Tk apps will look different than most of the desktop. However, since you only want to run one, stand-alone, that's not an issue. Tk is probably easier to learn than Gtk+ or Qt.

Fortunately, python is very cross-platform, so you do not have to start out by learning this on the pi. I do recommend you use a linux system, but I am sure you can learn the fundamentals on OSX or Windows as well. You should find yourself a tutorial on using python with the toolkit/library you like (ncurses, Gtk+, Qt, or Tk) and go from there; getting a book, once you are sure about the topic, is also a good idea.


1. While I'm not familiar with the python port specifically, ncurses is a bit more "lower level" feeling than GUI libraries, meaning that you end up having to do certain things manually that you would not otherwise, and it can become awkward and tedious. It does have certain advantages, but I don't think they will be applicable to your case.

0

As well as the good ideas from @goldilocks, there is also the framebuffer, /dev/fb0. This is not to be confused with the X11 screen, but is a low-level memory-mappable pixel-addressable drawing area.

See here for an example C program that works on the pi. It needs no extra libraries. Look here for more examples and explanations.

0

Just use python kivy library... you can run apps from console, no need to boot X11 at all... it works with own opengl drivers...

https://kivy.org/

or use prebuild images:

http://kivypie.mitako.eu/kivy-download.html

or just use pip to install it...

0

Or you could try it again using Tkinter/Tk/ttk. I encountered some troubles in attempting that, too, but finally it worked out greatly. This Q&A explains how I got it to work. The tkinter-widget (something like a sub-library) you'd want to use in order to draw something is called "canvas".

And in regard to the graphical appeal, I have to add something to goldilocks answer:

There is also Tk, which has a bit more of an "old school" look -- if you google for "Tk widgets" and check out the images you'll get the idea. It can be made to look pretty funky; the main drawback visually is that Tk apps will look different than most of the desktop. However, since you only want to run one, stand-alone, that's not an issue. Tk is probably easier to learn than Gtk+ or Qt.

If you use ttk instead of the regular Tkinter, your GUI will look like all your other desktop windows,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.