a ze@sddlZddlZdZgdZdZdZdZdZdd ZGd d d Z d!d d Z d"ddZ e dkr~e Ze ddedZeeeedeedeeeedeedee eededeejede ddZeedejdedejededZeejedejdZee eddZejed ejededS)#Nz0.9)NORMALROMANBOLDITALIC nametofontFontfamiliesnamesZnormalZromanboldZitaliccCs t|ddS)zFGiven the name of a tk named font, returns a Font representation. T)nameexists)rr r@/opt/bitninja-python-dojo/embedded/lib/python3.9/tkinter/font.pyrsrc@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_set2s z Font._setcCs$g}|D]}|d|qt|Sr)rr)rargsrrrrr_get9sz 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 ||ddvrtj d|j f|r|jdd|j g|Rn|jdd |j g|Rd |_ ||_ |j|_|j|_dS) Nzuse fonttkfontactualFr z$named font %s does not already exist configureZcreateT)tkinter_get_default_rootgetattr splitlistcallrrnextcounterr delete_fontZ_tkinterZTclError_tk_split_call)rrootr%r r rr$rrr__init__Es,    z Font.__init__cCs|jSNr rrrr__str__dsz Font.__str__cCs&t|tstS|j|jko$|j|jkSr5) isinstancerNotImplementedr r0)rotherrrr__eq__gs z Font.__eq__cCs ||Sr5)cget)rkeyrrr __getitem__lszFont.__getitem__cCs|jfi||idSr5)r')rr=valuerrr __setitem__oszFont.__setitem__cCs2z|jr|dd|jWnty,Yn0dS)Nr%delete)r/r2r Exceptionr6rrr__del__rs  z Font.__del__cCst|jfi|S)z*Return a distinct copy of the current font)rr0r&r6rrrcopyysz Font.copycCsbd}|rd|f}|r:|d|f}|jdd|jg|RS|||jdd|jg|RSdS)zReturn actual font attributesr -displayofrr%r&N)r2r r#r1)roption displayofrrrrr&}sz Font.actualcCs|dd|jd|S)zGet font attributer%configr)r2r )rrFrrrr<sz Font.cgetc KsD|r$|jdd|jg||Rn|||dd|jSdS)zModify font attributesr%rHN)r2r rr#r1)rrrrrrHs z Font.configcCs4|f}|rd||f}|j|jdd|jg|RS)zReturn text widthrEr%measure)r0getintr2r )rtextrGrrrrrIs z Font.measurecOsd}|dd}|rd|f}|rN|||}|j|jdd|jg|RS||jdd|jg|R}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.rrGNrEr%metricsrrr) poprr0rJr2r r1r r!)rrrrrGresr"rrrrLs &z Font.metrics)NNNF)NN)N)__name__ __module__ __qualname____doc__ itertoolscountr.rrr#r4r7r;r>r@rCrDr&r<rHr'rIrLrrrrrs$     rcCs<|std}d}|rd|f}|j|jjddg|RS)zGet font families (as a tuple)zuse font.families()rrEr%rr(r)r$r+r,)r3rGrrrrrs  rcCs$|std}|j|jddS)z'Get names of defined fonts (as a tuple)zuse font.names()r%r rU)r3rrrr s r __main__times)familysizeweightrYr[ZhelloZ linespace)rG)ZCourierr )r%z Hello, world)rKr%zQuit!)rKZcommandr%)r[)NN)N)rSr( __version____all__rrrrrrrr rOZTkr3fprintr&rHr<rIrLZLabelwpackZButtonZdestroyrDZfbZmainlooprrrrsD