/* jquery */ /* jquery accordion style*/ /* jquery init */

From tkinter to AppJar (part 1)

As part of my free Raspberry Pi Python Coding tutorial series I showed how to create Graphical User Interfaces with the tkinter module.

However, while it's a very flexible piece of software, writing tkinter apps tends to involve quite a bit of code. In this post I'll look at a lightweight GUI alternative called AppJar.

Although App Jar is based on tkinter, it removes the need for much of the so-called 'boilerplate' code. And this means we can focus our attention on widget-based UI design.

Install AppJar

First, you'll need to install AppJar.

The easiest way is to use the following pip command:
sudo pip3 install appjar

Alternatively, download Appjar, unzip it and move the appjar folder to your source code folder.

Simple AppJar Example

Let's start with an AppJar version of my single button callback tkinter tutorial (which included a detailed walk-through of the code).

With your favourite Python 3 editor, open a new code file and enter this code:

Notice the size of this program. We've replicated the functionality of the 25 line tkinter example with just 8 lines of AppJar code.

In part 2 we'll converting a tinter-based file search app to App Jar.

Try My Free Raspberry Pi Python Coding Tutorials

No comments: