B ^.©Žùû 1ã@sŒdZdZdZddddddd d d d d ddddddddddddddgZddlZddlmZmZmZmZe ƒZ ej dkrvd nd!Z d"d#„Z dXd$d%„ZdYd&d'„Zd(d)„ZdZd*d+„Zd[d,d-„Zd\d/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Zd=d>„Zd?d„Zd]d@d„ZGdAd„de ƒZGdBdC„dCejƒZGdDd„deƒZGdEd„deƒZ GdFd„deej!ƒZ!GdGd„de!ƒZ"GdHd„deƒZ#GdId„deƒZ$GdJd „d eƒZ%e%Z&GdKd „d eƒZ'GdLd „d eƒZ(GdMd „d eej)ƒZ*e*Z)GdNd„deƒZ+GdOd„deƒZ,GdPd„deej-ƒZ-GdQd„deej.ƒZ.GdRd„deƒZ/GdSd„deƒZ0GdTd„de!ƒZ1GdUd„deej2ej3ƒZ4GdVd„de#ƒZ5GdWd„de'ƒZ6dS)^aæTtk 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Ú CheckbuttonÚComboboxÚEntryÚFrameÚLabelÚ LabelframeÚ LabelFrameÚ MenubuttonÚNotebookÚ PanedwindowÚ PanedWindowÚ ProgressbarÚ RadiobuttonÚScaleÚ ScrollbarÚ SeparatorÚSizegripÚSpinboxÚStyleÚTreeviewÚ LabeledScaleÚ OptionMenuÚ tclobjs_to_pyÚ setup_masteréN)Ú_flattenÚ_joinÚ _stringifyÚ _splitdictg!@TFcCsBtr>ddl}|j d¡}|r,|j d|¡|j d¡d|_dS)NrZ TILE_LIBRARYz(global auto_path; lappend auto_path {%s}zpackage require tileT)Ú _REQUIRE_TILEÚosÚenvironÚgetÚtkÚevalÚ _tile_loaded)Úmasterr Ztilelib©r'ú0/opt/alt/python37/lib64/python3.7/tkinter/ttk.pyÚ _load_tile$s  r)cCs(|rt|ƒ}nt|ttfƒr$t|ƒ}|S)zInternal function.)rÚ isinstanceÚlistÚtupler)ÚvalueÚscriptr'r'r(Ú_format_optvalue3s  r/cCsTg}xF| ¡D]:\}}|r"||kr| d|¡|dk r| t||ƒ¡qWt|ƒS)z¿Formats 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')z-%sN)ÚitemsÚappendr/r)Zoptdictr.ÚignoreÚoptsÚoptr-r'r'r(Ú_format_optdict=s r5cCsdg}xZ|D]R^}}|dt|ƒdkr6|dp2d}n d |¡}| |¡|dk r | |¡q W|S)NréÚú )ÚlenÚjoinr1)r0Zopt_valÚstateÚvalr'r'r(Ú_mapdict_valuesMs   r=cCs>g}x0| ¡D]$\}}| d|tt|ƒ|ƒf¡qWt|ƒS)zÜFormats 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}')z-%s)r0Úextendr/r=r)Zmapdictr.r3r4r-r'r'r(Ú_format_mapdictds  r?c OsÊd}d}|dkr€|dkrB|d}tt|dd…ƒƒ}d||f}n2|dd…\}} tt|dd…ƒƒ} d || | f}t||ƒ}n,|d kr¬|d}t|ƒdkr¬t|d|ƒf}|rÂd |}d  |¡}||fS) zAFormats args and kw according to the given element factory etype.Nr')ÚimageZvsapir@rr6z%s %séz%s %s %sÚfromz{%s}r8)rr=r5r9r/r:) Úetyper.ÚargsÚkwÚspecr3ZinameZ imagespecÚ class_nameZpart_idZstatemapr'r'r(Ú_format_elemcreateus&   rHrAc CsÂg}x®|D]¦}|\}}|pi}d t|ddƒ¡}dd|||rFd|ndf}d|kr¦| |d¡||7}t|d||ƒ\} }| | ¡||8}| d d|¡q | |¡q Wd  |¡|fS) a$Formats 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 rightr8T)Úchildrenz%s%s%sz %sr7rIz -children {z%s}Ú )r:r5r1Ú_format_layoutlist) ÚlayoutÚindentZ indent_sizer.Z layout_elemÚelemr3ZfoptsÚheadZ newscriptr'r'r(rKšs     rKc Csbg}xP| ¡D]B\}}| d¡rJd t|ddƒ¡}| d||f¡| d¡rzd t|ddƒ¡}| d||f¡d|kr²|dsd}nt|dƒ\}}| d ||f¡| d ¡r|d }|d }d }x&|t|ƒkröt||d ƒsö|d 7}qÒW|d |…} |t|ƒkr$||r$||ni} t |df| ž| Ž\} }| d||| |f¡qWd |¡S)zReturns an appropriate script, based on settings, according to theme_settings definition to be used by theme_settings and theme_create.Ú configurer8Tzttk::style configure %s %s;Úmapzttk::style map %s %s;rLÚnullzttk::style layout %s { %s }zelement createrr6r0z%ttk::style element create %s %s %s %srJ) r0r"r:r5r1r?rKr9ÚhasattrrH) Úsettingsr.Únamer3ÚsÚ_ZeoptsrCZargcZelemargsZelemkwrFr'r'r(Ú_script_from_settingsËs2     $rXcCspg}xN|D]F}t|ddƒ}|dkr.| |¡q t|ƒ}|dkrF| ¡}| |¡q Wt|ƒ}dd„t||ƒDƒS)ztConstruct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict.ÚtypenameNÚ StateSpeccSsg|] }t|ƒ‘qSr')r)Ú.0rFr'r'r(ú sz(_list_from_statespec..)Úgetattrr1ÚstrÚsplitÚiterÚzip)ZstupleZnvalr<rYÚitr'r'r(Ú_list_from_statespecõs   rccCsª| |¡}g}d}x’|t|ƒkr¤||}i}| ||f¡|d7}x^|t|ƒkr |||d…\}}| d¡spP|dd…}|d7}|dkr–t||ƒ}|||<qDWqW|S)zpConstruct a list from the tuple returned by ttk::layout, this is somewhat the reverse of _format_layoutlist.rr6rAú-NrI)Ú splitlistr9r1Ú startswithÚ_list_from_layouttuple)r#ZltupleÚresZindxrUr3r4r<r'r'r(rgs$    rgcGs4t|ƒ}|j||Ž}t|ƒdr&|St||tdS)ahFormat 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.rA)Úconv)r5Úcallr9rÚ _tclobj_to_py)r#ÚoptionsrDrhr'r'r(Ú _val_or_dict"s  rmc Cs2t|ƒ}y t|ƒ}Wnttfk r,YnX|S)zAConverts a value to, hopefully, a more appropriate Python object.)r^ÚintÚ ValueErrorÚ TypeError)r-r'r'r(Ú_convert_stringval2s  rqcCs(t|tƒr$d|krt|ƒ}nt|ƒ}|S)NÚ.)r*r^Úfloatrn)Úxr'r'r(Ú _to_number<s   rucCs\|rFt|dƒrFt|tƒsFt|dddƒdkr6t|ƒ}qXttt|ƒƒ}nt|dƒrXt|ƒ}|S)z8Return value converted from Tcl object to Python object.Ú__len__rrYNrZ)rSr*r^r]rcr+rQrq)r<r'r'r(rkDs  rkcCs&x | ¡D]\}}t|ƒ||<q W|S)zOReturns adict with its values converted from Tcl objects to Python objects.)r0rk)Zadictr4r<r'r'r(rQscCs*|dkr&tjrtjpt ¡}ntdƒ‚|S)aIf 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.NzINo master specified and tkinter is configured to not support default root)ÚtkinterZ_support_default_rootZ _default_rootZTkÚ RuntimeError)r&r'r'r(rYs c@s‚eZdZdZdZddd„Zddd„Zddd „Zdd d „Zd d d „Z dd„Z dd„Z dd„Z d!dd„Z dd„Zdd„Zd"dd„ZdS)#rzManipulate style database.z ttk::styleNcCs0t|ƒ}t|ddƒst|ƒ||_|jj|_dS)Nr%F)rr]r)r&r#)Úselfr&r'r'r(Ú__init__os  zStyle.__init__cKs4|dk rd||<t|j||jd|ƒ}|s,|r0|SdS)zÐQuery 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.NrP)rmr#Ú_name)ryÚstyleÚ query_optrEÚresultr'r'r(rPzs zStyle.configurec KsT|dk r,t|j |j |jd|d|¡¡ƒSt|j|jj|jd|ft|ƒžŽtdS)aSQuery 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.NrQz-%s)ri)rcr#rerjr{rr?rk)ryr|r}rEr'r'r(rQ‡sz Style.mapcCs.|rd |¡nd}|j |jd|d|||¡S)aReturns the value specified for option in style. If state is specified it is expected to be a sequence of one or more states. If the default argument is set, it is used as a fallback value in case no specification for option is found.r8r7Úlookupz-%s)r:r#rjr{)ryr|Úoptionr;Údefaultr'r'r(r™sz Style.lookupcCs>d}|rt|ƒd}n |dk r"d}t|j|j |jd||¡ƒS)aÚDefine the widget layout for given style. If layoutspec is omitted, return the layout specification for given style. layoutspec is expected to be a list or an object different than None that evaluates to False if you want to "turn off" that style. If it is a list (or tuple, or something else), each item should be a tuple where the first item is the layout name and the second item should have the format described below: LAYOUTS A layout can contain the value None, if takes no options, or a dict of options specifying how to arrange the element. The layout mechanism uses a simplified version of the pack geometry manager: given an initial cavity, each element is allocated a parcel. Valid options/values are: side: whichside Specifies which side of the cavity to place the element; one of top, right, bottom or left. If omitted, the element occupies the entire cavity. sticky: nswe Specifies where the element is placed inside its allocated parcel. children: [sublayout... ] Specifies a list of elements to place inside the element. Each element is a tuple (or other sequence) where the first item is the layout name, and the other is a LAYOUT.NrrRrL)rKrgr#rjr{)ryr|Z layoutspecZlspecr'r'r(rL¥s z Style.layoutcOs8t|df|ž|Ž\}}|jj|jdd|||f|žŽdS)z9Create a new element in the current theme of given etype.FÚelementÚcreateN)rHr#rjr{)ryÚ elementnamerCrDrErFr3r'r'r(Úelement_createÐszStyle.element_createc Cs(tdd„|j |j |jdd¡¡DƒƒS)z:Returns the list of elements defined in the current theme.css|]}| d¡VqdS)rdN)Úlstrip)r[Únr'r'r(ú Ùsz&Style.element_names..r‚Únames)r,r#rerjr{)ryr'r'r(Ú element_names×szStyle.element_namesc Cs*tdd„|j |j |jdd|¡¡DƒƒS)z)Return the list of elementname's options.css|]}| d¡VqdS)rdN)r†)r[Úor'r'r(rˆßsz(Style.element_options..r‚rl)r,r#rerjr{)ryr„r'r'r(Úelement_optionsÝszStyle.element_optionsc CsN|r t|ƒnd}|r2|j |jdd|d|d|¡n|j |jdd|d|¡dS)a.Creates 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.r7Úthemerƒz-parentz -settingsN)rXr#rjr{)ryÚ themenameÚparentrTr.r'r'r(Ú theme_createãs zStyle.theme_createcCs"t|ƒ}|j |jdd||¡dS)aTemporarily 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.rrTN)rXr#rjr{)ryrŽrTr.r'r'r(Útheme_settingsôszStyle.theme_settingscCs|j |j |jdd¡¡S)z#Returns a list of all known themes.rr‰)r#rerjr{)ryr'r'r(Ú theme_namesszStyle.theme_namescCs&|dkr|j d¡S|j d|¡dS)z¨If 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#r$rj)ryrŽr'r'r(Ú theme_uses zStyle.theme_use)N)N)N)NN)N)NN)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r{rzrPrQrrLr…rŠrŒrr‘r’r“r'r'r'r(rjs  +  c@s6eZdZdZd dd„Zdd„Zd dd„Zd d d „ZdS)ÚWidgetz!Base class for Tk themed widgets.NcCs4t|ƒ}t|ddƒst|ƒtjj||||ddS)a´Constructs 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 r%F)rEN)rr]r)rwr˜rz)ryr&Z widgetnamerEr'r'r(rzs zWidget.__init__cCs|j |jd||¡S)zºReturns 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.Úidentify)r#rjÚ_w)ryrtÚyr'r'r(r™2szWidget.identifyc Os6|j |j |jdd |¡¡¡}|r2|r2|||ŽS|S)a1Test 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.Úinstater8)r#Ú getbooleanrjršr:)ryÚ statespecÚcallbackrDrEZretr'r'r(rœ:s  zWidget.instatecCs0|dk rd |¡}|j t|j |jd|¡ƒ¡S)aModify 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.Nr8r;)r:r#rer^rjrš)ryržr'r'r(r;Is z Widget.state)N)N)N)r”r•r–r—rzr™rœr;r'r'r'r(r˜s   r˜c@s"eZdZdZddd„Zdd„ZdS)rzcTtk Button widget, displays a textual label and/or image, and evaluates a command when pressed.NcKst ||d|¡dS)aConstruct 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::buttonN)r˜rz)ryr&rEr'r'r(rzZs zButton.__init__cCs|j |jd¡S)z/Invokes the command associated with the button.Úinvoke)r#rjrš)ryr'r'r(r isz Button.invoke)N)r”r•r–r—rzr r'r'r'r(rVs c@s"eZdZdZddd„Zdd„ZdS)rz;Ttk Checkbutton widget which is either in on- or off-state.NcKst ||d|¡dS)a'Construct 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::checkbuttonN)r˜rz)ryr&rEr'r'r(rzqs zCheckbutton.__init__cCs|j |jd¡S)aWToggles 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.r )r#rjrš)ryr'r'r(r €szCheckbutton.invoke)N)r”r•r–r—rzr r'r'r'r(rns c@s2eZdZdZd dd„Zdd„Zdd„Zd d „ZdS) rzeTtk Entry widget displays a one-line text string and allows that string to be edited by the user.NcKst |||pd|¡dS)a…Constructs 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::entryN)r˜rz)ryr&ZwidgetrEr'r'r(rzszEntry.__init__cCs| |j |jd|¡¡S)zqReturn a tuple of (x, y, width, height) which describes the bounding box of the character given by index.Úbbox)Ú_getintsr#rjrš)ryÚindexr'r'r(r¡¢sz Entry.bboxcCs|j |jd||¡S)zxReturns the name of the element at position x, y, or the empty string if the coordinates are outside the window.r™)r#rjrš)ryrtr›r'r'r(r™¨szEntry.identifycCs|j |j |jd¡¡S)zÉForce 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.Úvalidate)r#rrjrš)ryr'r'r(r¤®szEntry.validate)NN)r”r•r–r—rzr¡r™r¤r'r'r'r(r‹s  c@s,eZdZdZd dd„Zd dd„Zdd„ZdS) rzMTtk Combobox widget combines a text field with a pop-down list of values.NcKstj||df|ŽdS)aConstruct 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::comboboxN)rrz)ryr&rEr'r'r(rz¹s zCombobox.__init__cCs2|dkr |j |j |jd¡¡S|j |jd|¡S)aIf 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.NÚcurrent)r#Úgetintrjrš)ryZnewindexr'r'r(r¥ÈszCombobox.currentcCs|j |jd|¡dS)z(Sets the value of the combobox to value.ÚsetN)r#rjrš)ryr-r'r'r(r§Òsz Combobox.set)N)N)r”r•r–r—rzr¥r§r'r'r'r(rµs  c@seZdZdZddd„ZdS)rzJTtk Frame widget is a container, used to group other widgets together.NcKst ||d|¡dS)zÓConstruct a Ttk Frame with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS borderwidth, relief, padding, width, height z ttk::frameN)r˜rz)ryr&rEr'r'r(rzÛs zFrame.__init__)N)r”r•r–r—rzr'r'r'r(r×sc@seZdZdZddd„ZdS)rz7Ttk Label widget displays a textual label and/or image.NcKst ||d|¡dS)aGConstruct 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::labelN)r˜rz)ryr&rEr'r'r(rzìs zLabel.__init__)N)r”r•r–r—rzr'r'r'r(résc@seZdZdZddd„ZdS)rz Ttk 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.NcKst ||d|¡dS)zùConstruct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height zttk::labelframeN)r˜rz)ryr&rEr'r'r(rzs zLabelframe.__init__)N)r”r•r–r—rzr'r'r'r(rüsc@seZdZdZddd„ZdS)r zbTtk Menubutton widget displays a textual label and/or image, and displays a menu when pressed.NcKst ||d|¡dS)aConstruct a Ttk Menubutton with parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS direction, menu zttk::menubuttonN)r˜rz)ryr&rEr'r'r(rzs zMenubutton.__init__)N)r”r•r–r—rzr'r'r'r(r sc@sneZdZdZddd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z ddd„Z ddd„Z dd„Z dd„ZdS)r zÐTtk Notebook widget manages a collection of windows and displays a single one at a time. Each child window is associated with a tab, which the user may select to change the currently-displayed window.NcKst ||d|¡dS)a\Construct a Ttk Notebook with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS height, padding, width TAB OPTIONS state, sticky, padding, text, image, compound, underline TAB IDENTIFIERS (tab_id) The tab_id argument found in several methods may take any of the following forms: * An integer between zero and the number of tabs * The name of a child window * A positional specification of the form "@x,y", which defines the tab * The string "current", which identifies the currently-selected tab * The string "end", which returns the number of tabs (only valid for method index) z ttk::notebookN)r˜rz)ryr&rEr'r'r(rz)szNotebook.__init__cKs |jj|jd|ft|ƒžŽdS)z”Adds a new tab to the notebook. If window is currently managed by the notebook but hidden, it is restored to its previous position.ÚaddN)r#rjršr5)ryÚchildrEr'r'r(r¨Isz Notebook.addcCs|j |jd|¡dS)zXRemoves the tab specified by tab_id, unmaps and unmanages the associated window.ÚforgetN)r#rjrš)ryÚtab_idr'r'r(rªQszNotebook.forgetcCs|j |jd|¡dS)zèHides the tab specified by tab_id. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the add command.ÚhideN)r#rjrš)ryr«r'r'r(r¬Wsz Notebook.hidecCs|j |jd||¡S)zZReturns the name of the tab element at position x, y, or the empty string if none.r™)r#rjrš)ryrtr›r'r'r(r™`szNotebook.identifycCs|j |j |jd|¡¡S)z|Returns the numeric index of the tab specified by tab_id, or the total number of tabs if tab_id is the string "end".r£)r#r¦rjrš)ryr«r'r'r(r£fszNotebook.indexcKs"|jj|jd||ft|ƒžŽdS)zãInserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed child. If child is already managed by the notebook, moves it to the specified position.ÚinsertN)r#rjršr5)ryÚposr©rEr'r'r(r­lszNotebook.insertcCs|j |jd|¡S)z÷Selects the specified tab. The associated child window will be displayed, and the previously-selected window (if different) is unmapped. If tab_id is omitted, returns the widget name of the currently selected pane.Úselect)r#rjrš)ryr«r'r'r(r¯uszNotebook.selectcKs$|dk rd||<t|j||jd|ƒS)züQuery or modify the options of the specific tab_id. If kw is not given, returns a dict of the tab option values. If option is specified, returns the value of that option. Otherwise, sets the options to the corresponding values.NÚtab)rmr#rš)ryr«r€rEr'r'r(r°sz Notebook.tabcCs|j |j |jd¡pd¡S)z2Returns a list of windows managed by the notebook.Útabsr')r#rerjrš)ryr'r'r(r±Šsz Notebook.tabscCs|j d|j¡dS)aöEnable keyboard traversal for a toplevel window containing this notebook. This will extend the bindings for the toplevel window containing this notebook as follows: Control-Tab: selects the tab following the currently selected one Shift-Control-Tab: selects the tab preceding the currently selected one Alt-K: where K is the mnemonic (underlined) character of any tab, will select that tab. Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook.zttk::notebook::enableTraversalN)r#rjrš)ryr'r'r(Úenable_traversalszNotebook.enable_traversal)N)N)N)r”r•r–r—rzr¨rªr¬r™r£r­r¯r°r±r²r'r'r'r(r $s   c@s>eZdZdZd dd„ZejjZdd„Zd dd„Z d d d „Z dS)r zfTtk Panedwindow widget displays a number of subwindows, stacked either vertically or horizontally.NcKst ||d|¡dS)zíConstruct a Ttk Panedwindow with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, width, height PANE OPTIONS weight zttk::panedwindowN)r˜rz)ryr&rEr'r'r(rz­szPanedwindow.__init__cKs"|jj|jd||ft|ƒžŽdS)záInserts a pane at the specified positions. pos is either the string end, and integer index, or the name of a child. If child is already managed by the paned window, moves it to the specified position.r­N)r#rjršr5)ryr®r©rEr'r'r(r­ÂszPanedwindow.insertcKs$|dk rd||<t|j||jd|ƒS)aQQuery or modify the options of the specified pane. pane is either an integer index or the name of a managed subwindow. If kw is not given, returns a dict of the pane option values. If option is specified then the value for that option is returned. Otherwise, sets the options to the corresponding values.NÚpane)rmr#rš)ryr³r€rEr'r'r(r³ËszPanedwindow.panecCs|j |j |jd||¡¡S)aLIf newpos is specified, sets the position of sash number index. May adjust the positions of adjacent sashes to ensure that positions are monotonically increasing. Sash positions are further constrained to be between 0 and the total size of the widget. Returns the new position of sash number index.Úsashpos)r#r¦rjrš)ryr£Znewposr'r'r(r´×szPanedwindow.sashpos)N)N)N) r”r•r–r—rzrwr rªr­r³r´r'r'r'r(r ©s   c@s6eZdZdZd dd„Zd dd„Zd dd„Zd d „ZdS)r a6Ttk Progressbar widget shows the status of a long-running operation. They can operate in two modes: determinate mode shows the amount completed relative to the total amount of work to be done, and indeterminate mode provides an animated display to let the user know that something is happening.NcKst ||d|¡dS)zãConstruct a Ttk Progressbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, length, mode, maximum, value, variable, phase zttk::progressbarN)r˜rz)ryr&rEr'r'r(rzës zProgressbar.__init__cCs|j |jd|¡dS)zÃBegin autoincrement mode: schedules a recurring timer event that calls method step every interval milliseconds. interval defaults to 50 milliseconds (20 steps/second) if omitted.ÚstartN)r#rjrš)ryZintervalr'r'r(rµùszProgressbar.startcCs|j |jd|¡dS)zRIncrements the value option by amount. amount defaults to 1.0 if omitted.ÚstepN)r#rjrš)ryZamountr'r'r(r¶szProgressbar.stepcCs|j |jd¡dS)zVStop autoincrement mode: cancels any recurring timer event initiated by start.ÚstopN)r#rjrš)ryr'r'r(r·szProgressbar.stop)N)N)N)r”r•r–r—rzrµr¶r·r'r'r'r(r äs    c@s"eZdZdZddd„Zdd„ZdS)rzeTtk Radiobutton widgets are used in groups to show or change a set of mutually-exclusive options.NcKst ||d|¡dS)aConstruct a Ttk Radiobutton with parent master. STANDARD OPTIONS class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width WIDGET-SPECIFIC OPTIONS command, value, variable zttk::radiobuttonN)r˜rz)ryr&rEr'r'r(rzs zRadiobutton.__init__cCs|j |jd¡S)zÐSets the option variable to the option value, selects the widget, and invokes the associated command. Returns the result of the command, or an empty string if no command is specified.r )r#rjrš)ryr'r'r(r !szRadiobutton.invoke)N)r”r•r–r—rzr r'r'r'r(rs c@s.eZdZdZd dd„Zd dd„Zd dd„ZdS) rzTtk Scale widget is typically used to control the numeric value of a linked variable that varies uniformly over some range.NcKst ||d|¡dS)zÚConstruct a Ttk Scale with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, from, length, orient, to, value, variable z ttk::scaleN)r˜rz)ryr&rEr'r'r(rz.s zScale.__init__cKsTtj||f|Ž}t|tdƒtfƒs,| |¡td|kd|kd|kgƒrP| d¡|S)z’Modify or query scale options. Setting a value for any of the "from", "from_" or "to" options generates a <> event.NrBÚfrom_Útoz<>)r˜rPr*Útyper^ÚupdateÚanyZevent_generate)ryZcnfrEZretvalr'r'r(rP<s   zScale.configurecCs|j |jd||¡S)zÐGet the current value of the value option, or the value corresponding to the coordinates x, y if they are specified. x and y are pixel coordinates relative to the scale widget origin.r")r#rjrš)ryrtr›r'r'r(r"Isz Scale.get)N)N)NN)r”r•r–r—rzrPr"r'r'r'r(r*s  c@seZdZdZddd„ZdS)rz;Ttk Scrollbar controls the viewport of a scrollable widget.NcKst ||d|¡dS)z»Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient zttk::scrollbarN)r˜rz)ryr&rEr'r'r(rzUs zScrollbar.__init__)N)r”r•r–r—rzr'r'r'r(rRsc@seZdZdZddd„ZdS)rzITtk Separator widget displays a horizontal or vertical separator bar.NcKst ||d|¡dS)z²Construct a Ttk Separator with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient zttk::separatorN)r˜rz)ryr&rEr'r'r(rzgs zSeparator.__init__)N)r”r•r–r—rzr'r'r'r(rcsc@seZdZdZddd„ZdS)rzlTtk Sizegrip allows the user to resize the containing toplevel window by pressing and dragging the grip.NcKst ||d|¡dS)zƒConstruct a Ttk Sizegrip with parent master. STANDARD OPTIONS class, cursor, state, style, takefocus z ttk::sizegripN)r˜rz)ryr&rEr'r'r(rzyszSizegrip.__init__)N)r”r•r–r—rzr'r'r'r(rusc@s"eZdZdZddd„Zdd„ZdS)rz™Ttk Spinbox is an Entry with increment and decrement arrows It is commonly used for number entry or to select from a list of string values. NcKstj||df|ŽdS)a/Construct a Ttk Spinbox widget with the parent master. STANDARD OPTIONS class, cursor, style, takefocus, validate, validatecommand, xscrollcommand, invalidcommand WIDGET-SPECIFIC OPTIONS to, from_, increment, values, wrap, format, command z ttk::spinboxN)rrz)ryr&rEr'r'r(rzŠs zSpinbox.__init__cCs|j |jd|¡dS)z'Sets the value of the Spinbox to value.r§N)r#rjrš)ryr-r'r'r(r§™sz Spinbox.set)N)r”r•r–r—rzr§r'r'r'r(rƒs c@s:eZdZdZdEdd„ZdFdd„ZdGdd„Zd d „ZdHd d „Zd d„Z dd„Z dd„Z dIdd„Z dJdd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„ZdKd#d$„ZdLd%d&„Zd'd(„ZeZd)d*„Zd+d,„Zd-d.„Zd/d0„Zedfd1d2„Zd3d4„Zd5d6„Zd7d8„Z d9d:„Z!d;d<„Z"dMd=d>„Z#dNd?d@„Z$dOdAdB„Z%dPdCdD„Z&dS)QrzîTtk Treeview widget displays a hierarchical collection of items. Each item has a textual label, an optional image, and an optional list of data values. The data values are displayed in successive columns after the tree label.NcKst ||d|¡dS)ašConstruct a Ttk Treeview with parent master. STANDARD OPTIONS class, cursor, style, takefocus, xscrollcommand, yscrollcommand WIDGET-SPECIFIC OPTIONS columns, displaycolumns, height, padding, selectmode, show ITEM OPTIONS text, image, values, open, tags TAG OPTIONS foreground, background, font, image z ttk::treeviewN)r˜rz)ryr&rEr'r'r(rz¥szTreeview.__init__cCs| |j |jd||¡¡pdS)aTReturns the bounding box (relative to the treeview widget's window) of the specified item in the form x y width height. If column is specified, returns the bounding box of that cell. If the item is not visible (i.e., if it is a descendant of a closed item or is scrolled offscreen), returns an empty string.r¡r7)r¢r#rjrš)ryÚitemÚcolumnr'r'r(r¡¼sz Treeview.bboxcCs"|j |j |jd|pd¡pd¡S)zhReturns a tuple of children belonging to item. If item is not specified, returns root children.rIr7r')r#rerjrš)ryr½r'r'r(Ú get_childrenÆszTreeview.get_childrencGs|j |jd||¡dS)zÉReplaces item's child with newchildren. Children present in item that are not present in newchildren are detached from tree. No items in newchildren may be an ancestor of item.rIN)r#rjrš)ryr½Z newchildrenr'r'r(Ú set_childrenÎszTreeview.set_childrencKs$|dk rd||<t|j||jd|ƒS)a Query or modify the options for the specified column. If kw is not given, returns a dict of the column option values. If option is specified then the value for that option is returned. Otherwise, sets the options to the corresponding values.Nr¾)rmr#rš)ryr¾r€rEr'r'r(r¾×szTreeview.columncGs|j |jd|¡dS)z_Delete all specified items and all their descendants. The root item may not be deleted.ÚdeleteN)r#rjrš)ryr0r'r'r(rÁâszTreeview.deletecGs|j |jd|¡dS)zöUnlinks all of the specified items from the tree. The items and all of their descendants are still present, and may be reinserted at another point in the tree, but will not be displayed. The root item may not be detached.ÚdetachN)r#rjrš)ryr0r'r'r(rÂèszTreeview.detachcCs|j |j |jd|¡¡S)zSReturns True if the specified item is present in the tree, False otherwise.Úexists)r#rrjrš)ryr½r'r'r(rÃñszTreeview.existscCs|j |jd|¡S)z}If item is specified, sets the focus item to item. Otherwise, returns the current focus item, or '' if there is none.Úfocus)r#rjrš)ryr½r'r'r(rÄ÷szTreeview.focuscKsP| d¡}|r,t|tƒs,|j ||j¡|d<|dk rt|ƒdkr&t|dttfƒr&|d}|j |jd||¡dS)Nr6rrÕ)r9r*r,r+r#rjrš)ryrÚr0r'r'r(Ú _selection©szTreeview._selectioncGs| d|¡dS)z.The specified items becomes the new selection.r§N)rÛ)ryr0r'r'r(Ú selection_set°szTreeview.selection_setcGs| d|¡dS)z0Add all of the specified items to the selection.r¨N)rÛ)ryr0r'r'r(Ú selection_addµszTreeview.selection_addcGs| d|¡dS)z5Remove all of the specified items from the selection.rÓN)rÛ)ryr0r'r'r(Úselection_removeºszTreeview.selection_removecGs| d|¡dS)z2Toggle the selection state of each specified item.rÔN)rÛ)ryr0r'r'r(Úselection_toggle¿szTreeview.selection_togglecCs@|j |jd|||¡}|dkr8|dkr8t|j|dtdS|SdS)a;Query or set the value of given item. With one argument, return a dictionary of column/value pairs for the specified item. With two arguments, return the current value of the specified column. With three arguments, set the value of given column in given item to the specified value.r§NF)Z cut_minusri)r#rjršrrk)ryr½r¾r-rhr'r'r(r§Äs  z Treeview.setcCs |j|jdd|f||dddS)z´Bind a callback for the given event sequence to the tag tagname. When an event is delivered to an item, the callbacks for each of the item's tags option are called.ÚtagÚbindr)r¨N)Z_bindrš)ryÚtagnameZsequencerŸr'r'r(Útag_bindÓszTreeview.tag_bindcKs&|dk rd||<t|j||jdd|ƒS)aBQuery or modify the options for the specified tagname. If kw is not given, returns a dict of the option settings for tagname. If option is specified, returns the value for that option for the specified tagname. Otherwise, sets the options to the corresponding values for the given tagname.NràrP)rmr#rš)ryrâr€rEr'r'r(Ú tag_configureÚszTreeview.tag_configurec CsF|dkr$|j |j |jdd|¡¡S|j |j |jdd||¡¡SdS)zØIf item is specified, returns 1 or 0 depending on whether the specified item has the given tagname. Otherwise, returns a list of all items which have the specified tag. * Availability: Tk 8.6NràZhas)r#rerjršr)ryrâr½r'r'r(Útag_hasçs zTreeview.tag_has)N)N)N)N)N)N)N)N)NN)NN)N)N)'r”r•r–r—rzr¡r¿rÀr¾rÁrÂrÃrÄrÆr™rÊrËrÌrÍr£r­r½rÎZreattachrÏrrÐrÑrÖrÕrÛrÜrÝrÞrßr§rãrärår'r'r'r(ržsF              csLeZdZdZddd„Z‡fdd„Zd d „Zed d „ƒZej d d „ƒZ‡Z S)rzÀA Ttk Scale widget with a Ttk Label widget indicating its current value. The Ttk Scale can be accessed through instance.scale, and Ttk Label can be accessed through instance.labelNré c Ksü| dd¡dk|_tj||f|Ž|p.t |¡|_|j |¡||_t |ƒ|_ t ||j||d|_ |j   d|j¡|jr|dnd}|dkrŒdnd}|j j|ddt |ƒj|d}|j j|dkrÂd nd d |j d |j¡|_|  d |j¡|  d|j¡dS)a‡Construct a horizontal LabeledScale with parent master, a variable to be associated with the Ttk Scale widget and its range. If variable is not specified, a tkinter.IntVar is created. WIDGET-SPECIFIC OPTIONS compound: 'top' or 'bottom' Specifies how to display the label relative to the scale. Defaults to 'top'. ZcompoundÚtop)Úvariabler¸r¹z<>Zbottomrt)ÚsideZfill)rér‡rV)ZanchorÚwz zN)ÚpopÚ _label_toprrzrwZIntVarÚ _variabler§Ú _last_validrÚlabelrÚscaleráÚ_adjustZpackZplaceZtrace_variableÚ_LabeledScale__tracecb) ryr&rèr¸r¹rEZ scale_sideZ label_sideZtmpr'r'r(rzþs   zLabeledScale.__init__csHy|j d|j¡Wntk r(YnX|`tƒ ¡d|_d|_dS)z9Destroy this widget and possibly its associated variable.rêN)ríZ trace_vdeleteròÚAttributeErrorÚsuperÚdestroyrïrð)ry)Ú __class__r'r(rõ!s zLabeledScale.destroycs„‡fdd„}tˆjdƒ}tˆjdƒ}||kr:||}}ˆj ¡}||krX|ksfnˆjˆ_dS|ˆ_|ˆjd<ˆ |¡dS)z1Adjust the label position according to the scale.csZˆ ¡ˆj ¡\}}ˆjr2ˆj ¡ˆj ¡}nˆj ¡ˆj ¡}ˆjj||ddS)N)rtr›)Zupdate_idletasksrðZcoordsrìZwinfo_yrïZwinfo_reqheightZplace_configure)rtr›)ryr'r(Ú adjust_label0s z*LabeledScale._adjust..adjust_labelrBr¹NÚtext)rurðrír"rîr-rïZ after_idle)ryrDr÷r¸r¹Znewvalr')ryr(rñ.s    zLabeledScale._adjustcCs |j ¡S)zReturn current scale value.)rír")ryr'r'r(r-IszLabeledScale.valuecCs|j |¡dS)zSet new scale value.N)rír§)ryr<r'r'r(r-Ns)NNrræ) r”r•r–r—rzrõrñÚpropertyr-ÚsetterÚ __classcell__r'r')rör(r÷s  #  cs<eZdZdZd dd„Zdd„Zd dd„Z‡fd d „Z‡ZS) rzmThemed OptionMenu, based after tkinter's OptionMenu, which allows the user to select a value from a menu.NcOs„|| dd¡| dd¡dœ}tj||f|Žtj|dd|d<||_| dd¡|_|rpt d tt |  ¡ƒƒ¡‚|j |f|žŽdS) a9Construct a themed OptionMenu widget with master as the parent, the resource textvariable set to variable, the initially selected value specified by the default parameter, the menu values given by *values and additional keywords. WIDGET-SPECIFIC OPTIONS style: stylename Menubutton style. direction: 'above', 'below', 'left', 'right', or 'flush' Menubutton direction. command: callback A callback that will be invoked after selecting an item. r|NÚ direction)Z textvariabler|rüF)ZtearoffÚmenurÅzunknown option -%s) rër rzrwZMenuríÚ _callbackZTclErrorrÏr`ÚkeysÚset_menu)ryr&rèrÚvaluesÚkwargsrEr'r'r(rzXs zOptionMenu.__init__cCs&|dkr| t ||¡¡St ||¡S)Nrý)Z nametowidgetr Ú __getitem__)ryr½r'r'r(ruszOptionMenu.__getitem__cGsV|d}| dd¡x,|D]$}|j|t |j||j¡|jdqW|rR|j |¡dS)zUBuild a new menu of radiobuttons with *values and optionally a default value.rýrÚend)rïrÅrèN)rÁZadd_radiobuttonrwZ_setitrírþr§)ryrrrýr<r'r'r(r|s  zOptionMenu.set_menucs,y|`Wntk rYnXtƒ ¡dS)z0Destroy this widget and its associated variable.N)rírórôrõ)ry)rör'r(rõŠs zOptionMenu.destroy)N)N) r”r•r–r—rzrrrõrûr'r')rör(rTs   )F)FN)F)F)rrA)N)7r—Ú __version__Ú __author__Ú__all__rwrrrrÚobjectrÖZ TkVersionrr)r/r5r=r?rHrKrXrcrgrmrqrurkrrrr˜rrrrrrrrr r r r r rrrrrrZXViewZYViewrrrr'r'r'r(Ú sp       % 1*   +B*"8*([]