class_docstr: Format a paragraph, comment block, or selection to a max width.
  
  Does basic, standard text formatting, and also understands Python
  comment blocks. Thus, for editing Python source code, this
  extension is really only suitable for reformatting these comment
  blocks or triple-quoted strings.
  
  Known problems with comment reformatting:
  * If there is a selection marked, and the first line of the
    selection is not complete, the block will probably not be detected
    as comments, and will have the normal "text formatting" rules
    applied.
  * If a comment block has leading whitespace that mixes tabs and
    spaces, they will not be considered part of the same block.
  * Fancy comments, like this bulleted list, aren't handled :-)
class_docstr_tok: ["Format","a","paragraph",",","comment","block",",","or","selection","to","a","max","width",".","Does","basic",",","standard","text","formatting",",","and","also","understands","Python","comment","blocks",".","Thus",",","for","editing","Python","source","code",",","this","extension","is","really","only","suitable","for","reformatting","these","comment","blocks","or","triple-quoted","strings",".","Known","problems","with","comment","reformatting",":","*","If","there","is","a","selection","marked",",","and","the","first","line","of","the","selection","is","not","complete",",","the","block","will","probably","not","be","detected","as","comments",",","and","will","have","the","normal","``","text","formatting","''","rules","applied",".","*","If","a","comment","block","has","leading","whitespace","that","mixes","tabs","and","spaces",",","they","will","not","be","considered","part","of","the","same","block",".","*","Fancy","comments",",","like","this","bulleted","list",",","are","n't","handled",":","-",")"]
docstr: Formats paragraph to a max width specified in idleConf.
  
  If text is selected, format_paragraph_event will start breaking lines
  at the max width, starting from the beginning selection.
  
  If no text is selected, format_paragraph_event uses the current
  cursor location to determine the paragraph (lines of text surrounded
  by blank lines) and formats it.
  
  The length limit parameter is for testing with a known value.
docstr_tok: ["Formats","paragraph","to","a","max","width","specified","in","idleConf",".","If","text","is","selected",",","format_paragraph_event","will","start","breaking","lines","at","the","max","width",",","starting","from","the","beginning","selection",".","If","no","text","is","selected",",","format_paragraph_event","uses","the","current","cursor","location","to","determine","the","paragraph","(","lines","of","text","surrounded","by","blank","lines",")","and","formats","it",".","The","length","limit","parameter","is","for","testing","with","a","known","value","."]
code: def format_paragraph_event(self, event, limit=None):
      """Formats paragraph to a max width specified in idleConf.
  
      If text is selected, format_paragraph_event will start breaking lines
      at the max width, starting from the beginning selection.
  
      If no text is selected, format_paragraph_event uses the current
      cursor location to determine the paragraph (lines of text surrounded
      by blank lines) and formats it.
  
      The length limit parameter is for testing with a known value.
      """
      limit = self.max_width if limit is None else limit
      text = self.editwin.text
      first, last = self.editwin.get_selection_indices()
      if first and last:
          data = text.get(first, last)
          comment_header = get_comment_header(data)
      else:
          first, last, comment_header, data = find_paragraph(
              text, text.index("insert")
          )
      if comment_header:
          newdata = reformat_comment(data, limit, comment_header)
      else:
          newdata = reformat_paragraph(data, limit)
      text.tag_remove("sel", "1.0", "end")
  
      if newdata != data:
          text.mark_set("insert", first)
          text.undo_block_start()
          text.delete(first, last)
          text.insert(first, newdata)
          text.undo_block_stop()
      else:
          text.mark_set("insert", last)
      text.see("insert")
      return "break"
  
imports: import re
  from tkinter.messagebox import askyesno
  from tkinter.simpledialog import askinteger
  from idlelib.config import idleConf
label_desc: Use image node_id 4 for calling the FormatParagraph obj's underlying member method code with example usage: obj.format_paragraph_event(event, limit) and returns: str