mò
l†ûEc           @   sü  d  Z  d Z d Z y e Wn d* \ Z Z n XyŒ d k Z d k Z d k Z d k Z d k	 Z	 e i
 i e i
 i e	 i e i ƒ  ƒ d d d ƒ ƒ e e e i
 ƒ Z d	 k l Z l Z Wn1 y e i i d
 e ƒ Wn e GHn X‚  n Xe i
 i e i d ƒ d Z e i
 i e ƒ d Z e i d ƒ i e ƒ i ƒ  Z d „  Z d „  Z d „  Z d k Z d k  Th  d d <d d <d d <d d <Z! d Z" d Z# e$ e! ƒ Z% d Z& d g e" e# Z' d d >d Z( d Z) e* e' ƒ e* e' ƒ a+ a, e* e' ƒ Z- d „  Z. d e i/ f d „  ƒ  YZ0 d  „  Z1 d! „  Z2 d" „  Z3 d# „  Z4 d$ „  Z5 e6 d% j ož e Z7 e i d Z8 e e j oR yD e9 e8 ƒ o3 e: d& e8 d ƒ o e i d Z7 e i d' Z8 n WqÌqÌXn e: d( e7 e e; e8 ƒ ƒ f ƒ p d) GHn d S(+   sa   simple program to display Mandelbrot set

   this variation uses reals instead of complex numberss-  
    mandelbrot -- display image of Mandelbrot set
    Copyright (C) 2005  John Comeau <jc.jcomeau.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    s7   Not all needed libraries found, upgrade or check path: i   i    Ni   t   libt   python(   s   gpls	   jclicenses   %s
s   [0-9A-Za-z]+c          G   s   t  S(   N(   t   False(   t   whatever(    (    t'   /home/jcomeau/www/www/src/mandelbrot.pyt
   DebugPrint2   s    c          G   s´   |  \ } } t | ƒ t i j o t | ƒ } n t t d ƒ o | i	 | ƒ Sn^ d } xP t d t | ƒ ƒ D]9 } | | | } | t | ƒ d j o | | } qo qo W| Sd S(   s   for pythons without str.joint   joint    i    i   N(   t   argst   stringt   arrayt   typet   typest
   StringTypet   evalt   hasattrt   strR   t   joinedt   ranget   lent   index(   R   R   R	   R   R
   (    (    R   R   5   s       c          G   sg   |  \ } } t | ƒ p
 d } n t d d ƒ o | i | ƒ Sn  t i t i	 | ƒ ƒ i | ƒ Sd S(   s   for pythons without str.splitR   t   splitN(
   R   R	   t   string_to_splitR   t   NoneR   R   t   ret   compilet   escape(   R   R	   R   (    (    R   R   C   s      
(   t   *t   leftf-2.1000000000000001t   rightf1.1000000000000001t   topf1.2t   bottomf-1.2i@  ið   s   #%02x%02x%02xi   i   c          G   sG   t  d t t t ƒ t ƒ  t i ƒ  } t ƒ  } | i
 ƒ  | i ƒ  d S(   sm   main routine

    draws outline of Mandelbrot set, eventually to allow zoom
    each pixel is z -> z^2 + z0
 s   myself, command, originalselfN(   R   t   myselft   commandt   originalselft   initconstantst   Tkintert   Tkt   tkt
   Mandelbrott   framet   packt   mainloop(   R   R(   R&   (    (    R   t
   mandelbrot]   s     	
R'   c           B   s2   t  Z d „  Z e Z d „  Z d „  Z d „  Z RS(   Nc         C   s´   t  i i |  ƒ t  i |  d t d t ƒ|  _ |  i i ƒ  t  i |  ƒ |  _	 t  i
 |  i	 d d d |  i ƒi d t ƒ t  i
 |  i	 d d d |  i ƒi d t ƒ |  i	 i ƒ  d  S(   Nt   widtht   heightt   textt   GoR!   t   sidet   Quit(   R$   t   Framet   __init__t   selft   CanvasR,   R-   t   canvasR)   t	   buttonbart   Buttont   generatet   LEFTt   stop(   R4   (    (    R   R3   k   s    c         G   s  |  i i d d ƒ x• t t ƒ D]‡ } |  i o d  Sn xl t t ƒ D]^ } | t | } t
 t | } |  i i | | | d | h  d t | | | f <ƒ t | <qE Wq  WxK t t
 ƒ D]= } |  i o d  Sn t d | d ƒ |  i ƒ  |  i ƒ  q¸ W|  i i d d ƒ d  S(   Nt   cursort   waiti   t   fills   starting iterationR   (   R4   R6   t   configR   R-   t   yt   stop_requestedR,   t   xR   t   maxiterationst
   iterationst   it   create_linet   colort   pixelst   nR   t   iteratet   update(   R4   R   R   RE   R@   RB   RI   (    (    R   R9   x   s&     
  + 
 
c      
   G   sá   xÚ t  t t ƒ ƒ D]Æ } t | } t t | | ƒ t | ƒ t | <y| t | d d t | d d t j  oO t	 | c d 7<t
 t	 | } |  i i t | h  d t | | | f <ƒ n Wq d d g t | <q Xq Wd  S(   Ni    i   i   R>   (   R   R   t   valuesR   t   zt   complex_addt   complex_multiplyt	   constantst   maxvalueRD   RC   RE   R4   R6   t   itemconfigureRH   RG   (   R4   R   R   RE   RM   (    (    R   RJ   ‰   s     
 )5c         C   s   t  |  _ |  i ƒ  d  S(   N(   t   TrueR4   RA   t   quit(   R4   (    (    R   R;   –   s    	(   t   __name__t
   __module__R3   R   RA   R9   RJ   R;   (    (    (    R   R'   j   s
   			c         C   s;   |  | \ } } \ } } | | | | | | | | g S(   N(   RE   t   jt   at   bt   ct   d(   RE   RW   RX   RZ   RY   R[   (    (    R   RO   š   s    c         C   s+   |  | \ } } \ } } | | | | g S(   N(   RE   RW   RX   RY   RZ   R[   (   RE   RW   RX   RZ   RY   R[   (    (    R   RN   ž   s    c          G   s0   t  d t  d } |  d } t  d | | t S(   NR   R   i    (   t   currentt
   heightspanR   t   pixelheightR-   (   R   R^   R]   (    (    R   t   heightvalue¢   s    
c          G   s0   t  d t  d } |  d } t  d | | t S(   NR   R   i    (   R\   t	   widthspanR   t
   pixelwidthR,   (   R   R`   Ra   (    (    R   t
   widthvalue§   s    
c          G   s‚   xQ t  t t ƒ ƒ D]= } | t t | t ƒ } } t | ƒ t	 | ƒ g t | <q Wt
 t ƒ a t d t d d !d t d ƒ d  S(   Ns   constants initializedi    i
   s   ...iöÿÿÿ(   R   R   RP   RI   R,   t   intRB   R@   Rb   R_   t   listRL   R   (   R   RI   R@   RB   (    (    R   R#   ¬   s       t   __main__s   type(%s) == types.FunctionTypei   s   %s%sR   (   i   i    (<   t   __doc__t	   Copyrightt   errormessageRS   R   t   syst   osR   R   t   pwdt   patht   appendR   t   getpwuidt   geteuidt   reprt   com.jcomeaut   gplt	   jclicenset   stderrt   writeR   t   argvR    t   splitextR!   R   t   searcht   groupR"   R   R$   t   Tkconstantst   startR,   R-   t   dictR\   RG   RD   RC   RQ   Rd   RP   RL   RH   R+   R2   R'   RO   RN   R_   Rb   R#   RU   t   functionR   R   R   t   tuple($   Rg   RG   R'   R+   R-   R   RD   Rb   Rr   R_   R   R#   R\   R,   R   RS   R{   R}   R$   R"   R   Ri   Rk   RN   R   RH   R   R    RC   R   Rh   RQ   Rs   R!   RO   Rj   (    (    R   t   ?   sf   -5				
	*	0					"" 
