Clutter Label
#!/usr/bin/env python
#
# [SNIPPET_NAME: Clutter Label]
# [SNIPPET_CATEGORIES: Clutter]
# [SNIPPET_DESCRIPTION: Simple Clutter example showing how to create a label]
# [SNIPPET_AUTHOR: Andy Breiner <[email protected]>]
# [SNIPPET_LICENSE: GPL]
# [SNIPPET_DOCS: http://clutter-project.org/docs/pyclutter/stable/]
import clutter
class ClutterLabel:
def __init__ (self):
# Create stage and set its properties.
self.stage = clutter.Stage()
self.stage.set_color(clutter.color_from_string('Black'))
self.stage.set_size(500, 400)
self.stage.set_title('Clutter Label')
self.stage.connect("destroy",clutter.main_quit)
# Create label and set its properties.
color = clutter.Color(0xff, 0xcc, 0xcc, 0xdd)
label = clutter.Text()
label.set_font_name('Mono 32')
label.set_text("Hello World!")
label.set_color(color)
label.set_position(100, 200)
# Add label to stage.
self.stage.add(label)
# Start main clutter loop.
self.stage.show_all()
clutter.main()
if __name__ == '__main__':
main = ClutterLabel()