e.SrSrSr/SQrSSKrSSKJrJrJrJr SBSjr SCSjr S r SBS jr SBS jr SDS jrS rSrSrSrSrSrSrSrSESjr"SS\5r"SS\R45r"SS\5r"SS\5r"SS\\R:5r"S S!\5r"S"S#\5r"S$S%\5r "S&S'\5r!\!r""S(S)\5r#"S*S+\5r$"S,S-\\RJ5r&\&r%"S.S/\5r'"S0S1\5r("S2S3\\RR5r)"S4S5\\RT5r*"S6S7\5r+"S8S9\5r,"S:S;\5r-"S<S=\\R\\R^5r0"S>S?\5r1"S@SA\#5r2g)FaTtk wrapper. This module provides classes to allow using Tk themed widget set. Ttk is based on a revised and enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style engine. Its basic idea is to separate, to the extent possible, the code implementing a widget's behavior from the code implementing its appearance. Widget class bindings are primarily responsible for maintaining the widget state and invoking callbacks, all aspects of the widgets appearance lies at Themes. z0.3.1z!Guilherme Polo )Button CheckbuttonComboboxEntryFrameLabel Labelframe LabelFrame MenubuttonNotebook Panedwindow PanedWindow Progressbar RadiobuttonScale Scrollbar SeparatorSizegripSpinboxStyleTreeview LabeledScale OptionMenu tclobjs_to_py setup_masterN)_flatten_join _stringify _splitdictczU(a [U5nU$[U[[45(a [ U5nU$)zInternal function.)r isinstancelisttupler)valuescripts 1/opt/imh/python3.13/lib/python3.13/tkinter/ttk.py_format_optvaluer' s9 5! L ED%= ) )e  Lc/nUR5HFupEU(aXB;dMURSU-5 UcM,UR[XQ55 MH [U5$)zFormats optdict to a tuple to pass it to tk.call. E.g. (script=False): {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns: ('-foreground', 'blue', '-padding', '1 2 3 4')-%s)itemsappendr'r)optdictr%ignoreoptsoptr$s r&_format_optdictr1*sW Dmmo * KK $  ,U;< & D>r(c/nUH[Gtp#[U5S:XaUS=(d SnOSRU5nURU5 UcMJURU5 M] U$)Nr )lenjoinr,)r+opt_valstatevals r&_mapdict_valuesr;:sbG  u:?!HNEHHUOEu ? NN3  Nr(c /nUR5H.up4URSU-[[U5U545 M0 [ U5$)zFormats mapdict to pass it to tk.call. E.g. (script=False): {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]} returns: ('-expand', '{active selected} grey focus {1, 2, 3, 4}')r*)r+extendr'r;r)mapdictr%r/r0r$s r&_format_mapdictr?OsO Dmmo  US[%oe&r(cSnSnUS:Xa9USnU/[USS5Q7nU(aU4nO [U54n[X15nUS:Xa=[U5S:aUupSn OUupn X[ [U 554n[X15nO+US :Xa%US4n[U5S:a[ USU54nU(a[U5nS R U5nXE4$/UQUP7$) zAFormats args and kw according to the given element factory etype.imagerr3Nvsapi))rAr3fromr5)r;rr1r6r#r'r7) etyper%argskwspecsr/iname imagespec class_namepart_idstatemaps r&_format_elemcreaterO`s E D Q7_T!"X67 LE9%'Er*  t9q="& J!H,0 )JeOH,E&FGr* &a  t9q=$T!Wf57D e xx~{|t|r(c/nUHnUupVU=(d 0nSR[USS55nSU-<U<U(aSU-OS<3nSU;aXURUS-5 X- n[USUU5upURU 5 X-nURSSU--5 MURU5 M S RU5U4$) aFormats a layout list so we can pass the result to ttk::style layout and ttk::style settings. Note that the layout doesn't have to be a list necessarily. E.g.: [("Menubutton.background", None), ("Menubutton.button", {"children": [("Menubutton.focus", {"children": [("Menubutton.padding", {"children": [("Menubutton.label", {"side": "left", "expand": 1})] })] })] }), ("Menubutton.indicator", {"side": "right"}) ] returns: Menubutton.background Menubutton.button -children { Menubutton.focus -children { Menubutton.padding -children { Menubutton.label -side left -expand 1 } } } Menubutton.indicator -side rightr5T)childrenz %sr4rQz -children {z%s} )r7r1r,_format_layoutlist) layoutindent indent_sizer% layout_elemelemr/foptshead newscripts r&rSrSs8F  zrt]CD<% R/OP   MM$/ 0  !F 24 3CV! I MM) $  !F MM%3<0 1 MM$ " 99V f $$r(c /nUR5GHup#URS5(a8SR[USS55nUR SU<SU<S35 URS5(a8SR[ USS55nUR SU<SU<S35 SU;a7US(dS nO[ US5upEUR S U<S U<S 35 URS 5(dMUS nUSnSnU[U5:a<[XhS5(d)US- nU[U5:a[XhS5(dM)USUn U[U5:a Xh(aXhO0n [US/U Q70U D6upUR SU<SU<SU <SU<35 GM SRU5$)zReturns an appropriate script, based on settings, according to theme_settings definition to be used by theme_settings and theme_create. configurer5Tzttk::style configure ;mapzttk::style map rTnullzttk::style layout z { z }zelement createrr3r+zttk::style element create rR) r+getr7r1r,r?rSr6hasattrrO) settingsr%namer/s_eoptsrFargcelemargselemkwrIs r&_script_from_settingsrksFnn&  88K k):DABA MM4C D 88E??ed; t >)$x.9 MMT1E F 88$ % %)*E!HEDU#GEK,I,I U#GEK,I,IQt}H$(3u:$5%+U[2F-eTOHOOLE MMeUE+ ,='B 99V r(c[U[5(aU$/n[U5n[X"5Hup4[ US5(a[U5R 5nOD[U[5(aUR 5nO[U[ [45(dU4n[ US5(a [U5nUR/UQUP75 M U$)zpConstruct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict.typename) r!striterziprbsplitr#r"r,)stupleresultitr9r:s r&_list_from_statespecrus&# F fB"k  5* % %J$$&E s # #KKMEEE4=11HE 3 # #c(C mmsm$" Mr(chURU5n/nSnU[U5:aXn0nURXE45 US- nU[U5:aPXUS-upgURS5(dO0USSnUS- nUS:Xa [ X5nXuU'U[U5:aMPU[U5:aMU$)zlConstruct a list from the tuple returned by ttk::layout, this is somewhat the reverse of _format_layoutlist.rr3-NrQ) splitlistr6r, startswith_list_from_layouttuple)tkltupleresindxrdr/r0r:s r&r{r{s\\& !F C D V | D<   S[ 4!8,HC>>#&&ab'C AIDj ,R5IS[ V & Jr(c[U5nUR"X!-6n[U5S-(aU$[X[S9$)aTFormat options then call Tk command with args and options and return the appropriate result. If no option is specified, a dict is returned. If an option is specified with the None value, the value for that option is returned. Otherwise, the function just sets the passed options and the caller shouldn't be expecting a return value anyway.rw)conv)r1callr6r _tclobj_to_py)r|optionsrGr~s r& _val_or_dictrs<g&G ''DN $C 7|a bM 22r(cb[U5n[U5nU$![[4a U$f=f)zAConverts a value to, hopefully, a more appropriate Python object.)rnint ValueError TypeError)r$s r&_convert_stringvalr's> JE E  L  "  L s ..cl[U[5(aSU;a [U5nU$[U5nU$)N.)r!rnfloatr)xs r& _to_numberr1s6!S !8aA HAA Hr(cU(ac[US5(aR[U[5(d=[USSS5S:Xa [ U5nU$[ [ [U55nU$[US5(a [U5nU$)z8Return value converted from Tcl object to Python object.__len__rrmN StateSpec)rbr!rngetattrrur"r_r)r:s r&rr9s| wsI&&z#s/C/C 3q6:t , ;&s+C J s-s34C J j ! ! % Jr(cRUR5Hup[U5X'M U$)zKReturns adict with its values converted from Tcl objects to Python objects.)r+r)adictr0r:s r&rrFs)KKM"3' " Lr(c6Uc[R"5nU$)zIf master is not None, itself is returned. If master is None, the default master is returned if there is one, otherwise a new master is created and returned. If it is not allowed to use the default root and master is None, RuntimeError is raised.)tkinter_get_default_root)masters r&rrNs~**, Mr(c\rSrSrSrSrSSjrSSjrSSjrSSjr SS jr S r S r S r SS jrSrSrSSjrSrg)riZzManipulate style database.z ttk::styleNc\[U5nXlURRUlgN)rrr|)selfrs r&__init__Style.__init___s f% ++..r(c vUbSX2'[URX0RSU5nU(dU(aU$g)zQuery or sets the default value of the specified option(s) in style. Each key in kw is an option and each value is either a string or a sequence identifying the value for that option.Nr])rr|_name)rstyle query_optrHrss r&r]Style.configurees8   BMdggr::{EJ YMr(c UbOURRURSUSU-5n[URR U55$URR"URSU/[ U5Q76n[ URU5R5VVs0sH*upVU[URR U55_M, snn$s snnf)a+Query or sets dynamic values of the specified option(s) in style. Each key in kw is an option and each value should be a list or a tuple (usually) containing statespecs grouped in tuples, or list, or something else of your preference. A statespec is compound of one or more states and then a value.r_r*)r|rrruryr?rr+)rrrrHrskvs r&r_ Style.maprs  WW\\$**eUEI >r(c[US/UQ70UD6GtpVURR"URSSX/UQUQ76 g)z9Create a new element in the current theme of given etype.FelementcreateN)rOr|rr)r elementnamerFrGrHrIr/s r&element_createStyle.element_createsF)%DDD   TZZHk    r(c [SURRURRURSS5555$)z:Returns the list of elements defined in the current theme.c3B# UHoRS5v M g7frxNlstrip).0ns r& &Style.element_names..s ;-:qXXc]]-:rnamesr#r|ryrrrs r& element_namesStyle.element_namessB;DGG,=,= GGLLY 8-:;; ;r(c [SURRURRURSSU5555$)z)Return the list of elementname's options.c3B# UHoRS5v M g7frr)ros r&r(Style.element_options..s#J-IqXXc]]-Irrrr)rrs r&element_optionsStyle.element_optionssIJDGG,=,= GGLLY ; G-IJJ Jr(c U(a [U5OSnU(a-URRURSSUSUSU5 gURRURSSUSU5 g)aCreates a new theme. It is an error if themename already exists. If parent is specified, the new theme will inherit styles, elements and layouts from the specified parent theme. If settings are present, they are expected to have the same syntax used for theme_settings.r4themerz-parentz -settingsNrkr|rr)r themenameparentrcr%s r& theme_createStyle.theme_creates^5=&x0"  GGLLWh 6; 8 GGLLWh V %r(cj[U5nURRURSSX5 g)agTemporarily sets the current theme to themename, apply specified settings and then restore the previous theme. Each key in settings is a style and each value may contain the keys 'configure', 'map', 'layout' and 'element create' and they are expected to have the same format as specified by the methods configure, map, layout and element_create respectively.rrcNr)rrrcr%s r&theme_settingsStyle.theme_settingss('x0  TZZ*iHr(cURRURRURSS55$)z#Returns a list of all known themes.rr)r|ryrrrs r& theme_namesStyle.theme_namess,ww  djj'7!KLLr(cxUcURRS5$URRSU5 g)zIf themename is None, returns the theme in use, otherwise, set the current theme to themename, refreshes all widgets and emits a <> event.Nzreturn $ttk::currentThemez ttk::setTheme)r|evalr)rrs r& theme_useStyle.theme_uses4  77<< ;< <  _i0r()rr|rNN)__name__ __module__ __qualname____firstlineno____doc__rrr]r_rrTrrrrrrr__static_attributes__rAr(r&rrZsK$ E! A" (>V; J %" IM 1r(rc<\rSrSrSrS SjrSrS SjrS SjrSr g) Widgetiz!Base class for Tk themed widgets.NcV[U5n[RRXX#S9 g)adConstructs a Ttk Widget with the parent master. STANDARD OPTIONS class, cursor, takefocus, style SCROLLABLE WIDGET OPTIONS xscrollcommand, yscrollcommand LABEL WIDGET OPTIONS text, textvariable, underline, image, compound, width WIDGET STATES active, disabled, focus, pressed, selected, background, readonly, alternate, invalid )rHN)rrrr)rr widgetnamerHs r&rWidget.__init__s%(f%j@r(cPURRURSX5$)zReturns the name of the element at position x, y, or the empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget.identifyr|r_wrrys r&rWidget.identifys ww||DGGZ66r(c URRURRURSSR U555nU(a UbU"U0UD6$U$)aTest the widget's state. If callback is not specified, returns True if the widget state matches statespec and False otherwise. If callback is specified, then it will be invoked with *args, **kw if the widget state matches statespec. statespec is expected to be a sequence.instater5)r| getbooleanrrr7)r statespeccallbackrGrHrets r&rWidget.instate!sWgg   TWWi)1DEG 8'T(R( ( r(c UbSRU5nURR[URR UR SU555$)zModify or inquire widget state. Widget state is returned if statespec is None, otherwise it is set according to the statespec flags and then a new state spec is returned indicating which flags were changed. statespec is expected to be a sequence.r5r9)r7r|ryrnrr)rrs r&r9 Widget.state0sG  +Iww  TWW\\$''7I%N!OPPr(rAr) rrrrrrrrr9rrAr(r&rrs+A07  Qr(rc(\rSrSrSrSSjrSrSrg)ri=z_Ttk Button widget, displays a textual label and/or image, and evaluates a command when pressed.Nc 2[RXSU5 g)zConstruct a Ttk Button widget with the parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, default, width z ttk::buttonNrrrrrHs r&rButton.__init__As mR8r(cNURRURS5$)z/Invokes the command associated with the button.invokerrs r&r Button.invokePsww||DGGX..r(rArrrrrrrrrrAr(r&rr=s) 9/r(rc(\rSrSrSrSSjrSrSrg)riUz;Ttk Checkbutton widget which is either in on- or off-state.Nc 2[RXSU5 g)zConstruct a Ttk Checkbutton widget with the parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, offvalue, onvalue, variable zttk::checkbuttonNrrs r&rCheckbutton.__init__X &8"=r(cNURRURS5$)a/Toggles between the selected and deselected states and invokes the associated command. If the widget is currently selected, sets the option variable to the offvalue option and deselects the widget; otherwise, sets the option variable to the option onvalue. Returns the result of the associated command.rrrs r&rCheckbutton.invokegsww||DGGX..r(rArrrAr(r&rrUsE >/r(rc4\rSrSrSrS SjrSrSrSrSr g) rirzaTtk Entry widget displays a one-line text string and allows that string to be edited by the user.Nc D[RXU=(d SU5 g)aEConstructs a Ttk Entry widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand WIDGET-SPECIFIC OPTIONS exportselection, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width VALIDATION MODES none, key, focus, focusin, focusout, all z ttk::entryNr)rrwidgetrHs r&rEntry.__init__vs f&< bAr(cnURURRURSU55$)ziReturn a tuple of (x, y, width, height) which describes the bounding box of the character given by index.bbox_getintsr|rr)rindexs r&r Entry.bboxs(}}TWW\\$''65ABBr(cPURRURSX5$)zpReturns the name of the element at position x, y, or the empty string if the coordinates are outside the window.rrrs r&rEntry.identifyww||DGGZ66r(cURRURRURS55$)zForce revalidation, independent of the conditions specified by the validate option. Returns False if validation fails, True if it succeeds. Sets or clears the invalid state accordingly.validater|rrrrs r&rEntry.validates,ww!!$'',,tww "CDDr(rAr) rrrrrrrrrrrAr(r&rrrs(B&C 7 Er(rc2\rSrSrSrSSjrSSjrSrSrg) rizITtk Combobox widget combines a text field with a pop-down list of values.Nc 4[R"XS40UD6 g)zConstruct a Ttk Combobox widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS exportselection, justify, height, postcommand, state, textvariable, values, width z ttk::comboboxNrrrs r&rCombobox.__init__s t_;;r(cUcHURRURS5nUS:XagURRU5$URRURSU5$)zIf newindex is supplied, sets the combobox value to the element at position newindex in the list of values. Otherwise, returns the index of the current value in the list of values or -1 if the current value does not appear in the list.currentr4)r|rrgetint)rnewindexr~s r&rCombobox.currentsZ  '',,tww 2Cby77>>#& &ww||DGGY99r(cRURRURSU5 g)z(Sets the value of the combobox to value.setNrrr$s r&r% Combobox.set  TWWeU+r(rAr) rrrrrrrr%rrAr(r&rrs < :,r(rc"\rSrSrSrSSjrSrg)rizFTtk Frame widget is a container, used to group other widgets together.Nc 2[RXSU5 g)zConstruct a Ttk Frame with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS borderwidth, relief, padding, width, height z ttk::frameNrrs r&rFrame.__init__ lB7r(rArrrrrrrrrAr(r&rrs  8r(rc"\rSrSrSrSSjrSrg)riz7Ttk Label widget displays a textual label and/or image.Nc 2[RXSU5 g)aConstruct a Ttk Label with parent master. STANDARD OPTIONS class, compound, cursor, image, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS anchor, background, font, foreground, justify, padding, relief, text, wraplength z ttk::labelNrrs r&rLabel.__init__s lB7r(rArr-rAr(r&rrs A 8r(rc"\rSrSrSrSSjrSrg)rizTtk Labelframe widget is a container used to group other widgets together. It has an optional label, which may be a plain text string or another widget.Nc 2[RXSU5 g)zConstruct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height zttk::labelframeNrrs r&rLabelframe.__init__s &7