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

From tkinter to AppJar (part 3)

In the previous tutorial, From tkinter to AppJar (part 2), we converted the file search tkinter app from an earlier tutorial to a shorter 30 line AppJar app.

This time we'll take the same file search app and add new code lines to enhance the user interface's look and feel via a series of configuration options.

With your favourite Python 3 editor open the previous file search code listing, then change the init() function to look like the listing below:

Let's take a closer look at the behaviour introduced by these new code lines.

On line 6 we create a splash screen with an appropriate text label.

On line 7 we set the background colour of the app window, in this case to orange.

On lines 8 and 9 we set the font size of the text labels and the buttons. Notice here the button font size is a little larger than the label font size.

Finally, on line 17 we ensure the "Start Path" text entry field is associated with the initial cursor focus.

You can find more information on AppJar's extensive widget collection and configuration capabilities at the official AppJar website.

Try My Free Raspberry Pi Python Coding Tutorials

From tkinter to AppJar (part 2)

In the previous tutorial, From tkinter to AppJar (part 1), we converted a simple tkinter app to a short 8 line AppJar app.

This time we'll try out some of the other App Jar widgets by converting a tinter-based file search app from a previous tutorial.

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

As you can see, we've replicated the functionality of the 53 line tkinter file search example with just 30 lines of AppJar code.

In part 3 we'll add new code lines to enhance the user interface's look and feel via a series of configuration options.

Try My Free Raspberry Pi Python Coding Tutorials

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