next up previous contents index
Next: 16.2 Standard Module stdwinevents Up: 16.1 Built-in Module stdwin Previous: 16.1.6 Text-edit Objects

16.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()



guido@cnri.reston.va.us

AltStyle によって変換されたページ (->オリジナル) /