new_contents: #-*- coding: utf-8 -*-
  from win32ui import IDD_SET_TABSTOPS
  from win32ui import IDC_EDIT_TABS
  from win32ui import IDC_PROMPT_TABS
  from win32con import IDOK
  from win32con import IDCANCEL
  
  import win32ui
  import win32con
  
  from pywin.mfc import dialog
  
  IDC_EDIT_USERNAME = 2000
  IDC_EDIT_PASSWORD = 2001
  
  
  def ConfigDialogTemplate(title):
      style = win32con.DS_SETFONT | win32con.DS_MODALFRAME | win32con.DS_FIXEDSYS | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU
      cs = win32con.WS_CHILD | win32con.WS_VISIBLE
      listCs = cs | win32con.LBS_NOINTEGRALHEIGHT | win32con.WS_VSCROLL | win32con.WS_TABSTOP
  
      dlg = [[title, (0, 0, 200, 75), style, None, (8, "MS Sans Serif")], ]
      s = cs | win32con.CBS_DROPDOWN | win32con.WS_VSCROLL | win32con.WS_TABSTOP
  
      dlg.append([130, u"用户名:", -1, (30, 10, 50, 10), cs | win32con.SS_LEFT])
      dlg.append(["EDIT", "", IDC_EDIT_USERNAME, (70, 8, 100, 12), cs])
  
      dlg.append([130, u"用户名:", -1, (30, 30, 50, 30), cs | win32con.SS_LEFT])
      dlg.append(["EDIT", "", IDC_EDIT_PASSWORD, (70, 30, 100, 12), cs])
  
      s = cs | win32con.WS_TABSTOP
      dlg.append([128, u"确认", win32con.IDOK, (30, 50, 50, 15), s | win32con.BS_DEFPUSHBUTTON])
  
      s = win32con.BS_PUSHBUTTON | s
      dlg.append([128, u"取消", win32con.IDCANCEL, (120, 50, 50, 15), s])
      return dlg
  
  
  class ConfigDialog(dialog.Dialog):
      def __init__(self):
          dialog.Dialog.__init__(self, ConfigDialogTemplate(u'输入用户名密码'))
          self.DoModal()
  
      def OnInitDialog(self):
          self.username = self.GetDlgItem(IDC_EDIT_USERNAME)
          self.password = self.GetDlgItem(IDC_EDIT_PASSWORD)
  
      def OnDestroy(self, msg):
          del self.username
          del self.password
  
      def OnOK(self):
          print self.username.GetLine(), '\n', self.password.GetLine()
  
      def destroy(self):
          self.close()
  
  
  if __name__ == '__main__':
      ConfigDialog()
  
subject: add config dialog