Saturday, May 16, 2020

Quick Notes on appJar (Button, Subwindow, TextEntry, Table, InfoBox)

 Notes On appJar

appJar

Create A Basic Window

Example

from appJar import gui
app = gui()
app.setSize(400,400)
app.setFont(16)
app.addLabel("Example")
app.go()

Button

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def pressA():
    app.addLabel("Pressed A")

app.addButton("A", pressA)
app.go()

app.addButton([title], [action when button is pressed])
before
before
after
enter image description here

Subwindows

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def pressA():
    app.startSubWindow("newWindow",title="This is a new winodw")
    app.go(startWindow="newWindow")

app.addButton("A", pressA)
app.go()

after pressing the button A
enter image description here

Table & Pop out info box

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def press(rowNumber):
    app.infoBox("infoBox", "My number is %d"%(rowNumber))


app.addTable("tableName",
    [["Table Title"],
    ["0"],
    ["1"],
    ["2"],
    ["3"]], action=press, actionButton="ButtonName", actionHeading="press me")#when action is set to a specific function, it will pass the row number to such function

app.go()

Row number starting from 0
enter image description here

Text Extry

from appJar import gui

app = gui()
app.setSize(400,400)
app.setFont(16)

def press():
    app.infoBox("infoBoxTitle","The fist one said: %s; the second on said: %s" % (app.getEntry("JustAnEntry"), app.getEntry("NamedEntry")))

app.addEntry("JustAnEntry")
app.addLabelEntry("NamedEntry")

app.addButton("Get Content From Entries", press)

app.go()

enter image description here

No comments:

Post a Comment