U e5d@ã@szdZddlZddlZdZdZdZdZdd„ZGd d „d ƒZd d d „Z d!d d„Z e dk�rve  ¡Z edded�Zee ¡ƒee d¡ƒee d¡ƒee ¡ƒee d¡ƒee d¡ƒee ƒƒee d¡e d¡ƒeeje d�ƒedd�Zee d¡ejde d�ƒeje ded�Ze ¡eje de jd�Ze ¡eedd� ¡Zejed�ejed�e ¡dS)"z0.9éNZnormalZromanÚboldZitaliccCs t|dd�S)zFGiven the name of a tk named font, returns a Font representation. T)ÚnameÚexists)ÚFont©r©rú$/usr/lib64/python3.8/tkinter/font.pyÚ nametofontsr c@sœeZdZdZe d¡Zdd„Zdd„Zdd„Z d#d d „Z d d„Z dd„Z dd„Z dd„Zdd„Zdd„Zd$dd„Zdd„Zdd„ZeZd%dd „Zd!d"„Zd S)&raö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) écCs:g}| ¡D]$\}}| d|¡| t|ƒ¡q t|ƒS©Nú-)ÚitemsÚappendÚstrÚtuple)ÚselfÚkwÚoptionsÚkÚvrrrÚ_set1s z Font._setcCs$g}|D]}| d|¡qt|ƒSr )rr)rÚargsrrrrrÚ_get8sz Font._getcCs:i}tdt|ƒdƒD] }||d|||dd…<q|S)Nrér )ÚrangeÚlen)rrrÚirrrÚ_mkdict>sz Font._mkdictNFcKsâ|st d¡}t|d|ƒ}|r4| | dd|¡¡}n | |¡}|sTdtt|jƒƒ}||_ |r¬d|_ |j | | dd¡¡kr�tj   d|j f¡‚|rÈ|jdd|j f|žŽn|jdd |j f|žŽd |_ ||_ |j|_|j|_dS) Nzuse fontÚtkÚfontÚactualFÚnamesz$named font %s does not already existÚ configureZcreateT)ÚtkinterÚ_get_default_rootÚgetattrÚ splitlistÚcallrrÚnextÚcounterrÚ delete_fontZ_tkinterZTclErrorÚ_tkÚ_splitÚ_call)rÚrootrrrrrrrrÚ__init__Ds,    ÿz Font.__init__cCs|jS©Nr©rrrrÚ__str__csz Font.__str__cCs&t|tƒstS|j|jko$|j|jkSr0)Ú isinstancerÚNotImplementedrr+)rÚotherrrrÚ__eq__fs z Font.__eq__cCs | |¡Sr0)Úcget)rÚkeyrrrÚ __getitem__kszFont.__getitem__cCs|jf||iŽdSr0)r")rr8ÚvaluerrrÚ __setitem__nszFont.__setitem__cCs4z|jr| dd|j¡Wntk r.YnXdS)NrÚdelete)r*r-rÚ Exceptionr1rrrÚ__del__qs z Font.__del__cCst|jf| ¡ŽS)z*Return a distinct copy of the current font)rr+r r1rrrÚcopyxsz Font.copycCs^d}|rd|f}|r8|d|f}|jdd|jf|žŽS| | |jdd|jf|žŽ¡¡SdS)zReturn actual font attributesrú -displayofr rr N)r-rrr,)rÚoptionÚ displayofrrrrr |sÿz Font.actualcCs| dd|jd|¡S)zGet font attributerÚconfigr )r-r)rrArrrr7ˆsz Font.cgetc KsB|r"|jdd|jf| |¡žŽn| | | dd|j¡¡¡SdS)zModify font attributesrrCN)r-rrrr,)rrrrrrCŒsÿÿz Font.configcCs2|f}|rd||f}|j |jdd|jf|žŽ¡S)zReturn text widthr@rÚmeasure)r+Úgetintr-r)rÚtextrBrrrrrD—s z Font.measurecOs®d}| dd¡}|rd|f}|rL|| |¡}|j |jdd|jf|žŽ¡S| |jdd|jf|žŽ¡}i}tdt|ƒdƒD](}|j ||d ¡|||d d…<q||SdS) z}Return font metrics. For best performance, create a dummy widget using this font before calling this method.rrBNr@rÚmetricsrrr ) Úpoprr+rEr-rr,rr)rrrrrBÚresrrrrrGžs ÿ&z Font.metrics)NNNF)NN)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú itertoolsÚcountr)rrrr/r2r6r9r;r>r?r r7rCr"rDrGrrrrrs$     rcCs6|st d¡}d}|rd|f}|j |jjd|žŽ¡S)zGet font families (as a tuple)zuse font.families()rr@rÚfamilies)rrP©r#r$rr&r')r.rBrrrrrP³s  rPcCs$|st d¡}|j |j dd¡¡S)z'Get names of defined fonts (as a tuple)zuse font.names()rr!rQ)r.rrrr!½s r!Ú__main__Útimesé)ÚfamilyÚsizeÚweightrUrWZhelloZ linespace)rB)ZCourierér)rz Hello, world)rFrzQuit!)rFZcommandr)rW)NN)N)Ú __version__rNr#ZNORMALZROMANZBOLDZITALICr rrPr!rJZTkr.ÚfÚprintr rCr7rDrGZLabelÚwZpackZButtonZdestroyr?ZfbZmainlooprrrrÚsB