ó
xFWgc           @   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   si   g  } xV | j  ƒ  D]H \ } } t | t ƒ s= t | ƒ } n  | j d | ƒ | j | ƒ q Wt | ƒ S(   Nt   -(   t   itemst
   isinstancet
   basestringt   strt   appendt   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   _get8   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__D   s(    !		$		c         C   s   |  j  S(   N(   R   (   R   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __str__a   s    c         C   s   t  | t ƒ o |  j | j k S(   N(   R   R   R   (   R   t   other(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __eq__d   s    c         C   s   |  j  | ƒ S(   N(   t   cget(   R   t   key(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __getitem__g   s    c         C   s   |  j  i | | 6  d  S(   N(   R    (   R   R5   t   value(    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   __setitem__j   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__m   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   copyv   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   z   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.pyR4   ƒ   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.pyRA   “   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(   RB   R.   R   R   R-   R   R   (   R   R   t   resR   (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyRD   —   s    %!$N(   t   __name__t
   __module__t   __doc__R   R   R   t   NoneR(   R0   R1   R3   R6   R8   R=   R>   R   R4   R@   R    RA   RD   (    (    (    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.pyRJ   ¨   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   RC   s   Hello, worlds   Quit!t   command(    (   RR   i   R   (   t   __version__R"   t   NORMALt   ROMANt   BOLDt   ITALICR   R   RI   RJ   R   RF   t   TkR/   t   fR   R@   R4   RA   RD   t   Labelt   wt   packt   Buttont   destroyR>   t   fbt   mainloop(    (    (    s#   /usr/lib/python2.7/lib-tk/tkFont.pyt   <module>	   s>   		

