FrontPage
»
CodingRecipes
»
SimpleEventHandlingRecipe
This builds upon HelloWorldRecipe, adding a button to close the app:
import PicoGUI
# for PG_APP_TOOLBAR you'd use PicoGUI.ToolbarApp()
app = PicoGUI.Application('Greetings')
l = app.addWidget('Label')
l.side = 'All'
l.text = 'Hello, World!'
l.font = ':24:Bold'
bye = app.addWidget('Button')
bye.text = 'Yeah, all right, now go away'
def closeapp(ev, button):
app.send(app, 'stop')
app.link(closeapp, bye, "activate")
app.run()