U e5d@@szdZddlZddlZdZdZdZdZddZGd d d Zd d d Z d!d dZ e dkrve Z eddedZeeeedeedeeeedeedee eededeeje deddZeedejde deje dedZeeje de jdZeeeddZejedejededS)"z0.9NZnormalZromanboldZitaliccCs t|ddS)zFGiven the name of a tk named font, returns a Font representation. T)nameexists)Fontrr$/usr/lib64/python3.8/tkinter/font.py nametofontsr c@seZdZdZedZddZddZddZ d#d d Z d dZ ddZ ddZ ddZddZddZd$ddZddZddZeZd%dd Zd!d"Zd S)&raRepresents 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|SN-)itemsappendstrtuple)selfkwoptionskvrrr_set1s z Font._setcCs$g}|D]}|d|qt|Sr )rr)rargsrrrrr_get8sz Font._getcCs:i}tdt|dD] }||d|||dd<q|S)Nrr )rangelen)rrrirrr_mkdict>sz Font._mkdictNFcKs|std}t|d|}|r4||dd|}n ||}|sTdtt|j}||_ |rd|_ |j ||ddkrtj d|j f|r|jdd|j f|n|jdd |j f|d |_ ||_ |j|_|j|_dS) Nzuse fonttkfontactualFnamesz$named font %s does not already exist configureZcreateT)tkinter_get_default_rootgetattr splitlistcallrrnextcounterr delete_fontZ_tkinterZTclError_tk_split_call)rrootrrrrrrrr__init__Ds,    z Font.__init__cCs|jSNrrrrr__str__csz Font.__str__cCs&t|tstS|j|jko$|j|jkSr0) isinstancerNotImplementedrr+)rotherrrr__eq__fs z Font.__eq__cCs ||Sr0)cget)rkeyrrr __getitem__kszFont.__getitem__cCs|jf||idSr0)r")rr8valuerrr __setitem__nszFont.__setitem__cCs4z|jr|dd|jWntk r.YnXdS)Nrdelete)r*r-r Exceptionr1rrr__del__qs z Font.__del__cCst|jf|S)z*Return a distinct copy of the current font)rr+r r1rrrcopyxsz Font.copycCs^d}|rd|f}|r8|d|f}|jdd|jf|S|||jdd|jf|SdS)zReturn actual font attributesr -displayofr rr N)r-rrr,)roption displayofrrrrr |sz Font.actualcCs|dd|jd|S)zGet font attributerconfigr )r-r)rrArrrr7sz Font.cgetc KsB|r"|jdd|jf||n|||dd|jSdS)zModify font attributesrrCN)r-rrrr,)rrrrrrCsz Font.configcCs2|f}|rd||f}|j|jdd|jf|S)zReturn text widthr@rmeasure)r+getintr-r)rtextrBrrrrrDs z Font.measurecOsd}|dd}|rd|f}|rL|||}|j|jdd|jf|S||jdd|jf|}i}tdt|dD](}|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@rmetricsrrr ) poprr+rEr-rr,rr)rrrrrBresrrrrrGs &z Font.metrics)NNNF)NN)N)__name__ __module__ __qualname____doc__ itertoolscountr)rrrr/r2r6r9r;r>r?r r7rCr"rDrGrrrrrs$     rcCs6|std}d}|rd|f}|j|jjd|S)zGet font families (as a tuple)zuse font.families()rr@rfamilies)rrPr#r$rr&r')r.rBrrrrrPs  rPcCs$|std}|j|jddS)z'Get names of defined fonts (as a tuple)zuse font.names()rr!rQ)r.rrrr!s r!__main__times)familysizeweightrUrWZhelloZ linespace)rB)ZCourierr)rz Hello, world)rFrzQuit!)rFZcommandr)rW)NN)N) __version__rNr#ZNORMALZROMANZBOLDZITALICr rrPr!rJZTkr.fprintr rCr7rDrGZLabelwZpackZButtonZdestroyr?ZfbZmainlooprrrrsB