STDWIN Example -- Python library reference



Prev: Text-edit Objects Up: stdwin Top: Top

15.1.7. Example

Here is a minimal example of using STDWIN in Python. It creates a window and draws the string ``Hello world'' in the top left corner of the window. The window will be correctly redrawn when covered and re-exposed. The program quits when the close icon or menu item is requested.

import stdwin

from stdwinevents import *

def main():

mywin = stdwin.open('Hello')

#

while 1:

(type, win, detail) = stdwin.getevent()

if type == WE_DRAW:

draw = win.begindrawing()

draw.text((0, 0), 'Hello, world')

del draw

elif type == WE_CLOSE:

break

main()



Prev: Text-edit Objects Up: stdwin Top: Top