Beta Widgets


The following widgets are in beta.
They're available and in use, they're just not quite complete, and not fully tested...

ttk


If you want access to the Tk themed widget set then you'll need to tell appJar to use it:

from appJar import gui
app = gui("ttk Demo")
app.useTtk()
app.addButton("Press Me", None)
app.go()

At the moment, this simply imports ttk, so the standard widget set will be replaced with a ttk widget set.

MicroBit Emulator


Widget to emulate a MicroBit

MicroBit Emulator

from appJar import gui

app = gui()
app.addMicroBit("mb1")
app.setMicroBitImage("mb1", "09090:90909:90009:09090:00900")
app.go()

Add MicroBits

Set MicroBits

GoogleMaps


A self-contained GoogleMaps widget.
It provides useful functionality for finding somewhere on Earth.
All requests for map data are performed in the background, so the UI shouldn't become unresponsive.

GoogleMaps

from appjar import gui

app = gui()
app.addGoogleMap("m1")
app.setGoogleMapSize("m1", "300x500")
app.go()

Add GoogleMaps

Set GoogleMaps

Get GoogleMaps

Save GoogleMaps

PieChart


Widget to depict a Pie Chart.
It will automatically calculate percentages, and draw a pie chart, given a dictionary of items and their amount.
The PieChart is purely for display purposes, and is not interactive, other than a simple mouse-over effect with a tooltip.
PieChart

from appJar import gui

app = gui()
app.addPieChart("p1", {"apples":50, "oranges":200, "grapes":75,
                        "beef":300, "turkey":150})
app.go()

Add PieCharts

Set PieCharts

Tree


Takes an arbitrary XML string, and converts it into a tree structure.

TreeWidget

from appJar import gui

app = gui()
app.addTree("t1",
            """<people>
            <person><name>Fred</name><age>45</age><gender>Male</gender></person>
            <person><name>Tina</name><age>37</age><gender>Female</gender></person>
            <person><name>CLive</name><age>28</age><gender>Male</gender></person>
            <person><name>Betty</name><age>51</age><gender>Female</gender></person>
            </people>""")
app.go()

Add Trees

Set Trees

Get Trees

Grid


Used to create a spreadsheet like interface.
The grid has mouse interactivity, with mouse-over highlighting, and mouse-click highlighting.
It is possible to include buttons at the end of each row, and an additional row of entry boxes, with their own button.

Grid

from appJar import gui

app = gui()
app.setFont(20)
app.addGrid("g1",
    [["Name", "Age", "Gender"],
    ["Fred", 45, "Male"],
    ["Tina", 37, "Female"],
    ["Clive", 28, "Male"],
    ["Betty", 51, "Female"]])
app.go()

Add Grids

Get Grids

Set Grids

To have the Press button on the entries row add a new row of data, try the following:

    def press(btn):
        if btn == "Press":     # the button on the entries row
            data = app.getGridEntries("g1")
            app.addGridRow("g1", data)

MatPlotLib


Support for embedding very basic MatPlotLib plots.

Plot

from numpy import sin, pi, arange
from appJar import gui 
import random

def getXY():
    x = arange(0.0, 3.0, 0.01)
    y = sin(random.randint(1,10) * pi * x)
    return x,y 

def generate(btn):
    # *getXY() will unpack the two return values
    # and pass them as separate parameters
    app.updatePlot("p1", *getXY())
    showLabels()

def showLabels():
    axes.legend(['The curve'])
    axes.set_xlabel("X Axes")
    axes.set_ylabel("Y Axes")
    app.refreshPlot("p1")

app = gui()
axes = app.addPlot("p1", *getXY())
showLabels()
app.addButton("Generate", generate)
app.go()