Sub Window


A way to add additional windows, which can be hidden and shown.

SubWindow

from appJar import gui 

def launch(win):
    app.showSubWindow(win)

app=gui()

# this is a pop-up
app.startSubWindow("one", modal=True)
app.addLabel("l1", "SubWindow One")
app.stopSubWindow()

# this is another pop-up
app.startSubWindow("two")
app.addLabel("l2", "SubWindow Two")
app.stopSubWindow()

# these go in the main window
app.addButtons(["one", "two"], launch)

app.go()

Start/Stop Sub Windows

Show/Hide Sub Windows

It's useful to be able to create a button that stops a SubWindow:
If you define a button, that calls .hideSubWindow() or .destroySubWindow(), and give it the same name as the SubWindow, then it will hide/destroy the SubWindow, and call any associated .stopFunction().

app.startSubWindow("Demo")
app.addLabel("l1", "Press the button to close this window")
# set the button's name to match the SubWindow's name
app.addNamedButton("CLOSE", "Demo", app.hideSubWindow)
app.stopSubWindow()

Set Sub Windows

Note, all functions available on the main window are also available on SubWindows.
Simply call those functions after starting a SubWindow.

app.startSubWindow("one", modal=True)
app.setBg("orange")
app.setGeometry("400x400")
app.setTransparency(25)
app.setStopFunction(checkDone)
app.addLabel("l1", "In sub window")
app.stopSubWindow()