ó
â·sWc           @   sÎ  d  Z  d d l Z d Z d Z d Z d Z d „  Z d d d	 „  ƒ  YZ d d
 „ Z	 d d „ Z
 e d k rÊe j ƒ  Z e d d d d d e ƒ Z e j ƒ  GHe j d ƒ GHe j d ƒ GHe j ƒ  GHe j d ƒ GHe j d ƒ GHe
 ƒ  GHe j d ƒ Ge j d ƒ GHe j ƒ  GHe d d ƒ Z e j d ƒ Ge j d ƒ GHe j e d d d e ƒZ e j ƒ  e j e d d d e j ƒZ e j ƒ  e d e d ƒ j ƒ  Z e j d e ƒ e j d e ƒ e j ƒ  n  d S(   s   0.9iÿÿÿÿNt   normalt   romant   boldt   italicc         C   s   t  d |  d t ƒ S(   sF   Given the name of a tk named font, returns a Font representation.
    t   namet   exists(   t   Fontt   True(   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt
   nametofont   s    R   c           B   sª   e  Z d  Z d „  Z d „  Z d „  Z d d d e d „ Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d d „ Z d „  Z d „  Z e Z d „  Z d „  Z RS(   sö  Represents a named font.

    Constructor options are:

    font -- font specifier (name, system font, or (family, size, style)-tuple)
    name -- name to use for this font configuration (defaults to a unique name)
    exists -- does a named font by this name already exist?
       Creates a new named font if False, points to the existing font if True.
       Raises _Tkinter.TclError if the assertion is false.

       the following are ignored if font is specified:

    family -- font 'family', e.g. Courier, Times, Helvetica
    size -- font size in points
    weight -- font thickness: NORMAL, BOLD
    slant -- font slant: ROMAN, ITALIC
    underline -- font underlining: false (0), true (1)
    overstrike -- font strikeout: false (0), true (1)

    c         C   sQ   g  } x> | j  ƒ  D]0 \ } } | j d | ƒ | j t | ƒ ƒ q Wt | ƒ S(   Nt   -(   t   itemst   appendt   strt   tuple(   t   selft   kwt   optionst   kt   v(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   _set/   s
    c         C   s2   g  } x | D] } | j  d | ƒ q Wt | ƒ S(   NR	   (   R   R   (   R   t   argsR   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   _get6   s    c         C   sG   i  } x: t  d t | ƒ d ƒ D]  } | | d | | | d <q W| S(   Ni    i   i   (   t   ranget   len(   R   R   R   t   i(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   _mkdict<   s    c         K   s=  | s t  j } n  t | d | ƒ } | rK | j | j d d | ƒ ƒ } n |  j | ƒ } | sy d t t |  ƒ ƒ } n  | |  _ | rö t	 |  _
 |  j | j | j d d ƒ ƒ k rÑ t  j j d |  j f ‚ n  | r| j d d |  j | Œ qn" | j d d |  j | Œ t |  _
 | |  _ | j |  _ | j |  _ d  S(   Nt   tkt   fontt   actualt   namess$   named font %s does not already existt	   configuret   create(   t   Tkintert   _default_roott   getattrt	   splitlistt   callR   R   t   idR   t   Falset   delete_fontt   _tkintert   TclErrorR   t   _tkt   _splitt   _call(   R   t   rootR   R   R   R   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __init__B   s(    !		$		c         C   s   |  j  S(   N(   R   (   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __str___   s    c         C   s   t  | t ƒ o |  j | j k S(   N(   t
   isinstanceR   R   (   R   t   other(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __eq__b   s    c         C   s   |  j  | ƒ S(   N(   t   cget(   R   t   key(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __getitem__e   s    c         C   s   |  j  i | | 6  d  S(   N(   R   (   R   R4   t   value(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __setitem__h   s    c         C   sW   y& |  j  r% |  j d d |  j ƒ n  Wn* t t f k
 rB ‚  n t k
 rR n Xd  S(   NR   t   delete(   R'   R,   R   t   KeyboardInterruptt
   SystemExitt	   Exception(   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __del__k   s    	c         C   s   t  |  j |  j ƒ   S(   s*   Return a distinct copy of the current font(   R   R*   R   (   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   copyt   s    c         C   sO   | r# |  j  d d |  j d | ƒ S|  j |  j |  j  d d |  j ƒ ƒ ƒ Sd S(   s   Return actual font attributesR   R   R	   N(   R,   R   R   R+   (   R   t   option(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR   x   s    c         C   s   |  j  d d |  j d | ƒ S(   s   Get font attributeR   t   configR	   (   R,   R   (   R   R>   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR3      s    c         K   sW   | r+ |  j  d d |  j |  j | ƒ Œ n( |  j |  j |  j  d d |  j ƒ ƒ ƒ Sd S(   s   Modify font attributesR   R?   N(   R,   R   R   R   R+   (   R   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR?   …   s
    c         C   s   t  |  j d d |  j | ƒ ƒ S(   s   Return text widthR   t   measure(   t   intR,   R   (   R   t   text(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR@   ‘   s    c         G   s    | r. t  |  j d d |  j |  j | ƒ ƒ ƒ S|  j |  j d d |  j ƒ ƒ } i  } x@ t d t | ƒ d ƒ D]& } t  | | d ƒ | | | d <qn W| Sd S(   s}   Return font metrics.

        For best performance, create a dummy widget
        using this font before calling this method.R   t   metricsi    i   i   N(   RA   R,   R   R   R+   R   R   (   R   R   t   resR   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyRC   •   s    %!$N(   t   __name__t
   __module__t   __doc__R   R   R   t   NoneR&   R.   R/   R2   R5   R7   R<   R=   R   R3   R?   R   R@   RC   (    (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR      s"   													
	c         C   s1   |  s t  j }  n  |  j j |  j j d d ƒ ƒ S(   s   Get font families (as a tuple)R   t   families(   R    R!   R   R#   R$   (   R-   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyRI   ¦   s    c         C   s1   |  s t  j }  n  |  j j |  j j d d ƒ ƒ S(   s'   Get names of defined fonts (as a tuple)R   R   (   R    R!   R   R#   R$   (   R-   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyR   ¬   s    t   __main__t   familyt   timest   sizei   t   weightt   hellot	   linespaceR   t   Courieri   RB   s   Hello, worlds   Quit!t   command(    (   RQ   i   R   (   t   __version__R    t   NORMALt   ROMANt   BOLDt   ITALICR   R   RH   RI   R   RE   t   TkR-   t   fR   R?   R3   R@   RC   t   Labelt   wt   packt   Buttont   destroyR=   t   fbt   mainloop(    (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   <module>	   s>   	Ž	

