B 382b@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)Font)rr1/opt/alt/python37/lib64/python3.7/tkinter/font.py nametofontsrc@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}x0|D]$\}}|d||t|qWt|S)N-)itemsappendstrtuple)selfkwoptionskvrrr_set1s z Font._setcCs(g}x|D]}|d|q Wt|S)Nr )r r)rargsrrrrr_get8s z Font._getcCs>i}x4tdt|dD] }||d|||dd<qW|S)Nrr )rangelen)rrrirrr_mkdict>s z Font._mkdictNFcKs|s tj}t|d|}|r0||dd|}n ||}|sPdtt|j}||_ |rd|_ |j ||ddkrtj d|j f|r|jdd|j f|n|jdd|j f|d |_ ||_ |j|_|j|_dS) NtkfontactualFnamesz$named font %s does not already exist configureZcreateT)tkinter _default_rootgetattr splitlistcallrr nextcounterr delete_fontZ_tkinterZTclError_tk_split_call)rrootrrrrrrrr__init__Ds*  z Font.__init__cCs|jS)N)r)rrrr__str__csz Font.__str__cCst|to|j|jkS)N) isinstancerr)rotherrrr__eq__fsz Font.__eq__cCs ||S)N)cget)rkeyrrr __getitem__iszFont.__getitem__cCs|jf||idS)N)r )rr3valuerrr __setitem__lszFont.__setitem__cCs4y|jr|dd|jWntk r.YnXdS)Nrdelete)r(r+r Exception)rrrr__del__os z Font.__del__cCst|jf|S)z*Return a distinct copy of the current font)rr)r)rrrrcopyvsz Font.copycCs^d}|rd|f}|r8|d|f}|jdd|jf|S|||jdd|jf|SdS)zReturn actual font attributesrz -displayofr rrN)r+rrr*)roption displayofrrrrrzsz Font.actualcCs|dd|jd|S)zGet font attributerconfigr )r+r)rr;rrrr2sz Font.cgetc KsB|r"|jdd|jf||n|||dd|jSdS)zModify font attributesrr=N)r+rrrr*)rrrrrr=s z Font.configcCs2|f}|rd||f}|j|jdd|jf|S)zReturn text widthz -displayofrmeasure)r)getintr+r)rtextr<rrrrr>s z Font.measurecOsd}|dd}|rd|f}|rL|||}|j|jdd|jf|S||jdd|jf|}i}xrArrrrrs$     rcCs2|s tj}d}|rd|f}|j|jjd|S)zGet font families (as a tuple)rz -displayofrfamilies)rrI)r!r"rr$r%)r,r<rrrrrIs rIcCs |s tj}|j|jddS)z'Get names of defined fonts (as a tuple)rr)r!r"rr$r%)r,rrrrsr__main__times)familysizeweightrMrOZhelloZ linespace)r<)ZCourierr)rz Hello, world)r@rzQuit!)r@Zcommandr)rO)NN)N) __version__rGr!ZNORMALZROMANZBOLDZITALICrrrIrrCZTkr,fprintrr=r2r>rAZLabelwZpackZButtonZdestroyr:ZfbZmainlooprrrrsB