#!/usr/local/bin/python ## # Hello2 # ------ # A version of the "Hello world" program which centers the # text in a window. # # The newwindow function creates a window, and setredraw associates # a redraw call-back function with the window. The show function # then causes the window to appear on screen. # # The call-back draw_window is passed the window and the # window's rectangle as parameters. It calls drawtext to # draw the words "Hello world" centered horizontally and vertically # inside that rectangle. ## from graphapp import * def draw_window(w, r): drawtext(r, Center + VCenter, "Hello world") def main(): w = newwindow("Hello World Window", rect(50,50,200,150), StandardWindow) setredraw(w, draw_window) show(w) mainloop() main()