def do_dialog():
 my_dlg = Dlg.GetNewDialog(ID_MAIN, (-1))
 while 1:
  n = Dlg.ModalDialog(None)
  if (n == ITEM_LOOKUP_BUTTON):
   (tp, h, rect) = my_dlg.GetDialogItem(ITEM_LOOKUP_ENTRY)
   txt = Dlg.GetDialogItemText(h)
   (tp, h, rect) = my_dlg.GetDialogItem(ITEM_RESULT)
   Dlg.SetDialogItemText(h, dnslookup(txt))
  elif (n == ITEM_QUIT_BUTTON):
   break

def do_dialog ( ) : my_dlg = Dlg . GetNewDialog ( ID_MAIN , ( - 1 ) ) while 1 : n = Dlg . ModalDialog ( None ) if ( n == ITEM_LOOKUP_BUTTON ) : ( tp , h , rect ) = my_dlg . GetDialogItem ( ITEM_LOOKUP_ENTRY ) txt = Dlg . GetDialogItemText ( h ) ( tp , h , rect ) = my_dlg . GetDialogItem ( ITEM_RESULT ) Dlg . SetDialogItemText ( h , dnslookup ( txt ) ) elif ( n == ITEM_QUIT_BUTTON ) : break
post dialog and handle user interaction until quit .