Skip to content

Home News Screenshots Wiki Themes Bugtracker Members Logos Search
  You are not logged in Link icon Log in Link icon Join
You are here: Home » PicoGUI Wiki » cli_python documentation » SimpleEventHandlingRecipe

Log in
 
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()

References

Application, Widget

Status

UpToDateStatus