# HelloMaemo.py (c) Kari Laitinen # 2006-10-05 First program version created. # 2006-10-05 Last modification. # This program draws two lines of text onto the screen. import gtk import hildon class HelloApplication( hildon.Program ) : def __init__( self ) : hildon.Program.__init__( self ) self.application_window = hildon.Window() self.application_window.connect( "destroy", gtk.main_quit ) self.add_window( self.application_window ) self.application_window.set_size_request( 600, 400 ) self.drawing_area = gtk.DrawingArea() self.drawing_area.set_size_request( 580, 360 ) self.drawing_area.connect( "expose-event", self.drawing_area_exposed ) self.application_window.add( self.drawing_area ) self.application_window.show_all() def drawing_area_exposed( self, area, event ) : graphics_context = self.drawing_area.get_style().fg_gc[gtk.STATE_NORMAL] this_drawable = self.drawing_area.window text_to_show = self.drawing_area.create_pango_layout( "" ) text_to_show.set_text( "Hello. I am a Python/Maemo application." ) this_drawable.draw_layout( graphics_context, 80, 100, text_to_show ) text_to_show.set_text( "The coordinates of this line are (80,150)." ) this_drawable.draw_layout( graphics_context, 80, 150, text_to_show ) return True def run( self ) : gtk.main() if __name__ == "__main__" : this_application = HelloApplication() this_application.run()