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 » HelloWorldWithServer » wikipage_view

Log in
FrontPage » ReferenceByClass » Server »


This is a sample of usage of the Server class.

This example is included with the library, in sample/ (or online - guaranteed up-to-date).

The code:

 # a version of Hello, World using the Server class

 import PicoGUI

 def test(address='localhost', display=0):
  server = PicoGUI.Server(address, display)
  top_id = server.register(server.getString('Greetings'))
  label_id = server.createWidget('Label')
  server.set(label_id, 'text', server.getString('Hello, World'))
  server.set(label_id, 'side', 'all')
  server.set(label_id, 'font', server.getFont(':24:Bold'))
  server.attachWidget(top_id, label_id, 'inside')
  return server

 def event_loop(server):
  while 1:
    ev = server.wait()
    if == 'close':

 if __name__ == '__main__':
        from sys import argv
        if len(argv) > 2: display = argv[2]
        else: display = 0
        if len(argv) > 1: address = argv[1]
        else: address = 'localhost'
        c = test(address, port)