This Page

Hello World ExampleΒΆ

hello_world_view.enaml

#------------------------------------------------------------------------------
#  Copyright (c) 2012, Enthought, Inc.
#  All rights reserved.
#------------------------------------------------------------------------------
from enaml.widgets.api import Window, Container, Label


enamldef Main(Window):
    attr message = "Hello, world!"
    Container:
        Label:
            text = message
            
$ enaml-run hello_world_view.enaml
../_images/hello_world.png

hello_world.py

#------------------------------------------------------------------------------
#  Copyright (c) 2011, Enthought, Inc.
#  All rights reserved.
#------------------------------------------------------------------------------
import enaml
from enaml.stdlib.sessions import show_simple_view


if __name__ == '__main__':
    with enaml.imports():
        from hello_world_view import Main

    main_view = Main()
    show_simple_view(main_view)
$ python hello_world.py
../_images/hello_world_python.png