[Python-checkins] CVS: python/dist/src/Lib/lib-tk tkSimpleDialog.py,1.4,1.5

Guido van Rossum guido@cnri.reston.va.us
Thu, 24 Feb 2000 10:01:46 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Lib/lib-tk
In directory eric:/projects/python/develop/guido/src/Lib/lib-tk

Modified Files:
	tkSimpleDialog.py 
Log Message:
Moshe Zadka:
Added docstrings to tkSimpleDialog.py


Index: tkSimpleDialog.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/lib-tk/tkSimpleDialog.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** tkSimpleDialog.py	1999/06/25 15:53:54	1.4
--- tkSimpleDialog.py	2000/02/24 15:01:43	1.5
***************
*** 12,15 ****
--- 12,29 ----
  # dialog base class
  
+ '''Dialog boxes
+ 
+ This module handles dialog boxes. It contains the following
+ public symbols:
+ 
+ Dialog -- a base class for dialogs
+ 
+ askinteger -- get an integer from the user
+ 
+ askfloat -- get a float from the user
+ 
+ askstring -- get a string from the user
+ '''
+ 
  from Tkinter import *
  import os
***************
*** 17,22 ****
--- 31,49 ----
  class Dialog(Toplevel):
  
+     '''Class to open dialogs.
+ 
+     This class is intended as a base class for custom dialogs
+     '''
+ 
      def __init__(self, parent, title = None):
  
+         '''Initialize a dialog.
+ 
+         Arguments:
+ 
+             parent -- a parent window (the application window)
+ 
+             title -- the dialog title
+         '''
          Toplevel.__init__(self, parent)
          self.transient(parent)
***************
*** 50,53 ****
--- 77,81 ----
  
      def destroy(self):
+         '''Destroy the window'''
          self.initial_focus = None
          Toplevel.destroy(self)
***************
*** 57,68 ****
  
      def body(self, master):
!         # create dialog body.  return widget that should have
!         # initial focus.  this method should be overridden
  
          pass
  
      def buttonbox(self):
!         # add standard button box. override if you don't want the
!         # standard buttons
          
          box = Frame(self)
--- 85,101 ----
  
      def body(self, master):
!         '''create dialog body.
  
+         return widget that should have initial focus. 
+         This method should be overridden, and is called
+         by the __init__ method.
+         '''
          pass
  
      def buttonbox(self):
!         '''add standard button box. 
! 
!         override if you don't want the standard buttons
!         '''
          
          box = Frame(self)
***************
*** 104,111 ****
--- 137,154 ----
  
      def validate(self):
+         '''validate the data
  
+         This method is called automatically to validate the data before the 
+         dialog is destroyed. By default, it always validates OK.
+         '''
+ 
          return 1 # override
  
      def apply(self):
+         '''process the data
+ 
+         This method is called automatically to process the data, *after*
+         the dialog is destroyed. By default, it does nothing.
+         '''
  
          pass # override
***************
*** 197,200 ****
--- 240,253 ----
  
  def askinteger(title, prompt, **kw):
+     '''get an integer from the user
+ 
+     Arguments:
+ 
+         title -- the dialog title
+         prompt -- the label text
+         **kw -- see SimpleDialog class
+ 
+     Return value is an integer
+     '''
      d = apply(_QueryInteger, (title, prompt), kw)
      return d.result
***************
*** 206,209 ****
--- 259,272 ----
  
  def askfloat(title, prompt, **kw):
+     '''get a float from the user
+ 
+     Arguments:
+ 
+         title -- the dialog title
+         prompt -- the label text
+         **kw -- see SimpleDialog class
+ 
+     Return value is a float
+     '''
      d = apply(_QueryFloat, (title, prompt), kw)
      return d.result
***************
*** 214,217 ****
--- 277,290 ----
  
  def askstring(title, prompt, **kw):
+     '''get a string from the user
+ 
+     Arguments:
+ 
+         title -- the dialog title
+         prompt -- the label text
+         **kw -- see SimpleDialog class
+ 
+     Return value is a string
+     '''
      d = apply(_QueryString, (title, prompt), kw)
      return d.result