U e5d@sdZdZdZddddddd d d d d ddddddddddddddgZddlZddlmZmZmZmZej dkrpd nd!Z d"d#Z dXd$d%Z dYd&d'Z d(d)ZdZd*d+Zd[d,d-Zd\d/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Zd=d>Zd?dZd]d@dZGdAddeZGdBdCdCejZGdDddeZGdEddeZGdFddeej Z GdGdde Z!GdHddeZ"GdIddeZ#GdJd d eZ$e$Z%GdKd d eZ&GdLd d eZ'GdMd d eej(Z)e)Z(GdNddeZ*GdOddeZ+GdPddeej,Z,GdQddeej-Z-GdRddeZ.GdSddeZ/GdTdde Z0GdUddeej1ej2Z3GdVdde"Z4GdWdde&Z5dS)^aTtk 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 _splitdictg!@TFcCsBtr>ddl}|jd}|r,|jd||jdd|_dS)NrZ TILE_LIBRARYz(global auto_path; lappend auto_path {%s}zpackage require tileT) _REQUIRE_TILEosenvirongettkeval _tile_loaded)masterr Ztilelibr'#/usr/lib64/python3.8/tkinter/ttk.py _load_tile"s  r)cCs(|rt|}nt|ttfr$t|}|S)zInternal function.)r isinstancelisttupler)valuescriptr'r'r(_format_optvalue1s  r/cCsPg}|D]:\}}|r ||kr |d||dk r |t||q t|S)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')-%sN)itemsappendr/r)Zoptdictr.ignoreoptsoptr-r'r'r(_format_optdict;s r6cCsXg}|D]J^}}t|dkr,|dp(d}n d|}|||dk r||q|S)Nr )lenjoinr2)r1Zopt_valstatevalr'r'r(_mapdict_valuesKs    r>cCs:g}|D]$\}}|d|tt||fq t|S)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}')r0)r1extendr/r>r)Zmapdictr.r4r5r-r'r'r(_format_mapdict`s   r@c Osd}d}|dkr|dkrB|d}tt|dd}d||f}n2|dd\}} tt|dd} d || | f}t||}n,|d kr|d}t|dkrt|d|f}|rd |}d |}||fS) zAFormats args and kw according to the given element factory etype.Nr')imageZvsapirArr7z%s %sz%s %s %sfromz{%s}r9)rr>r6r:r/r;) etyper.argskwspecr4ZinameZ imagespec class_nameZpart_idZstatemapr'r'r(_format_elemcreateqs&   rIrBc Csg}|D]}|\}}|pi}dt|dd}dd|||rDd|ndf}d|kr||d||7}t|d||\} }|| ||8}|d d|q||qd ||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 rightr9T)childrenz%s%s%sz %sr8rJz -children {z%s} )r;r6r2_format_layoutlist) layoutindentZ indent_sizer.Z layout_elemelemr4ZfoptsheadZ newscriptr'r'r(rLs"   rLc CsXg}|D]>\}}|drFdt|dd}|d||f|drvdt|dd}|d||fd|kr|dsd}nt|d\}}|d ||f|d r |d }|d }d }|t|krt||d s|d 7}q|d |} |t|kr||r||ni} t |df| | \} }|d||| |fq d|S)zReturns an appropriate script, based on settings, according to theme_settings definition to be used by theme_settings and theme_create. configurer9Tzttk::style configure %s %s;mapzttk::style map %s %s;rMnullzttk::style layout %s { %s }zelement createrr7r1z%ttk::style element create %s %s %s %srK) r1r"r;r6r2r@rLr:hasattrrI) settingsr.namer4s_ZeoptsrDZargcZelemargsZelemkwrGr'r'r(_script_from_settingss:     $ rYcCst|tr|Sg}t|}t||D]j\}}t|drDt|}n(t|trX|}nt|ttfsl|f}t|dr~t|}|||fq$|S)ztConstruct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict.typename) r*striterziprTsplitr,r+r2)Zstupleresultitr<r=r'r'r(_list_from_statespecs     racCs||}g}d}|t|kr||}i}|||f|d7}|t|kr|||d\}}|dslq|dd}|d7}|dkrt||}|||<q@q|S)zpConstruct a list from the tuple returned by ttk::layout, this is somewhat the reverse of _format_layoutlist.rr7rB-NrJ) splitlistr:r2 startswith_list_from_layouttuple)r#ZltupleresZindxrVr4r5r=r'r'r(res$       recGs4t|}|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.rB)conv)r6callr:r _tclobj_to_py)r#optionsrErfr'r'r( _val_or_dict!s  rkc Cs2t|}z t|}Wnttfk r,YnX|S)zAConverts a value to, hopefully, a more appropriate Python object.)r[int ValueError TypeError)r-r'r'r(_convert_stringval1s  rocCs(t|tr$d|krt|}nt|}|S)N.)r*r[floatrl)xr'r'r( _to_number;s   rscCs\|rFt|drFt|tsFt|ddddkr6t|}qXttt|}nt|drXt|}|S)z8Return value converted from Tcl object to Python object.__len__rrZNZ StateSpec)rTr*r[getattrrar+rRro)r=r'r'r(riCs  ricCs"|D]\}}t|||<q|S)zOReturns adict with its values converted from Tcl objects to Python objects.)r1ri)Zadictr5r=r'r'r(rPscCs|dkrt}|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.N)tkinterZ_get_default_root)r&r'r'r(rXsc@seZdZdZdZdddZdddZddd Zdd d Zd d d Z ddZ ddZ ddZ d!ddZ ddZddZd"ddZdS)#rzManipulate style database.z ttk::styleNcCs0t|}t|ddst|||_|jj|_dS)Nr%F)rrur)r&r#)selfr&r'r'r(__init__is  zStyle.__init__cKs4|dk rd||<t|j||jd|}|s,|r0|SdS)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.NrQ)rkr#_namerwstyleZ query_optrFr_r'r'r(rQts zStyle.configurec sj|dk r0jjd|d|}tj|Sjjjd|ft|}fddtj|DS)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.NrRr0cs"i|]\}}|tj|qSr')rar#rc).0kvrwr'r( szStyle.map..)r#rhryrarcr@rr1rzr'rr(rRs z 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.r9r8lookupr0)r;r#rhry)rwr{optionr<defaultr'r'r(rs z Style.lookupcCs>d}|rt|d}n |dk r"d}t|j|j|jd||S)aDefine 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.NrrSrM)rLrer#rhry)rwr{Z layoutspecZlspecr'r'r(rMs z Style.layoutcOs8t|df||\}}|jj|jdd|||f|dS)z9Create a new element in the current theme of given etype.FelementcreateN)rIr#rhry)rw elementnamerDrErFrGr4r'r'r(element_creates zStyle.element_createc Cs(tdd|j|j|jddDS)z:Returns the list of elements defined in the current theme.css|]}|dVqdSrbNlstrip)r|nr'r'r( sz&Style.element_names..rnamesr,r#rcrhryrr'r'r( element_namesszStyle.element_namesc Cs*tdd|j|j|jdd|DS)z)Return the list of elementname's options.css|]}|dVqdSrr)r|or'r'r(rsz(Style.element_options..rrjr)rwrr'r'r(element_optionsszStyle.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.r8themerz-parentz -settingsNrYr#rhry)rw themenameparentrUr.r'r'r( theme_createszStyle.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.rrUNr)rwrrUr.r'r'r(theme_settingsszStyle.theme_settingscCs|j|j|jddS)z#Returns a list of all known themes.rr)r#rcrhryrr'r'r( theme_namesszStyle.theme_namescCs&|dkr|jdS|jd|dS)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#r$rh)rwrr'r'r( theme_uses zStyle.theme_use)N)N)N)NN)N)NN)N)__name__ __module__ __qualname____doc__ryrxrQrRrrMrrrrrrrr'r'r'r(rds  +  c@s6eZdZdZd ddZddZd ddZd d d ZdS)Widgetz!Base class for Tk themed widgets.NcCs4t|}t|ddst|tjj||||ddS)aConstructs 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)rFN)rrur)rvrrx)rwr&Z widgetnamerFr'r'r(rxs zWidget.__init__cCs|j|jd||S)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#rh_wrwrryr'r'r(r+szWidget.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.instater9)r# getbooleanrhrr;)rw statespeccallbackrErFZretr'r'r(r3s  zWidget.instatecCs0|dk rd|}|jt|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.Nr9r<)r;r#rcr[rhr)rwrr'r'r(r<Bs z Widget.state)N)N)N)rrrrrxrrr<r'r'r'r(r s   rc@s"eZdZdZdddZddZdS)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::buttonNrrxrwr&rFr'r'r(rxSs zButton.__init__cCs|j|jdS)z/Invokes the command associated with the button.invokerrr'r'r(rbsz Button.invoke)Nrrrrrxrr'r'r'r(rOs c@s"eZdZdZdddZddZdS)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::checkbuttonNrrr'r'r(rxjs zCheckbutton.__init__cCs|j|jdS)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.rrrr'r'r(ryszCheckbutton.invoke)Nrr'r'r'r(rgs c@s2eZdZdZd ddZddZddZd d ZdS) rzeTtk Entry widget displays a one-line text string and allows that string to be edited by the user.NcKst|||pd|dS)aConstructs 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)rwr&ZwidgetrFr'r'r(rxszEntry.__init__cCs||j|jd|S)zqReturn a tuple of (x, y, width, height) which describes the bounding box of the character given by index.bboxZ_getintsr#rhr)rwindexr'r'r(rsz 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.rrrr'r'r(rszEntry.identifycCs|j|j|jdS)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#rrhrrr'r'r(rszEntry.validate)NN)rrrrrxrrrr'r'r'r(rs  c@s,eZdZdZd ddZd ddZddZdS) 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::comboboxNrrxrr'r'r(rxs zCombobox.__init__cCs2|dkr |j|j|jdS|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.Ncurrentr#Zgetintrhr)rwZnewindexr'r'r(rszCombobox.currentcCs|j|jd|dS)z(Sets the value of the combobox to value.setNrrwr-r'r'r(rsz Combobox.set)N)N)rrrrrxrrr'r'r'r(rs  c@seZdZdZdddZdS)rzJTtk Frame widget is a container, used to group other widgets together.NcKst||d|dS)zConstruct a Ttk Frame with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS borderwidth, relief, padding, width, height z ttk::frameNrrr'r'r(rxs zFrame.__init__)Nrrrrrxr'r'r'r(rsc@seZdZdZdddZdS)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::labelNrrr'r'r(rxs zLabel.__init__)Nrr'r'r'r(rsc@seZdZdZdddZdS)rzTtk 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)zConstruct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height zttk::labelframeNrrr'r'r(rxs zLabelframe.__init__)Nrr'r'r'r(rsc@seZdZdZdddZdS)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::menubuttonNrrr'r'r(rxs zMenubutton.__init__)Nrr'r'r'r(r sc@sneZdZdZdddZddZddZd d Zd d Zd dZ ddZ dddZ dddZ ddZ ddZdS)r zTtk 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::notebookNrrr'r'r(rx"szNotebook.__init__cKs |jj|jd|ft|dS)zAdds a new tab to the notebook. If window is currently managed by the notebook but hidden, it is restored to its previous position.addNr#rhrr6)rwchildrFr'r'r(rBsz Notebook.addcCs|j|jd|dS)zXRemoves the tab specified by tab_id, unmaps and unmanages the associated window.forgetNrrwtab_idr'r'r(rJszNotebook.forgetcCs|j|jd|dS)zHides 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.hideNrrr'r'r(rPsz Notebook.hidecCs|j|jd||S)zZReturns the name of the tab element at position x, y, or the empty string if none.rrrr'r'r(rYszNotebook.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".rrrr'r'r(r_szNotebook.indexcKs"|jj|jd||ft|dS)zInserts 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.insertNrrwposrrFr'r'r(reszNotebook.insertcCs|j|jd|S)zSelects 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.selectrrr'r'r(rnszNotebook.selectcKs$|dk rd||<t|j||jd|S)zQuery 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.Ntabrkr#r)rwrrrFr'r'r(rxsz Notebook.tabcCs|j|j|jdpdS)z2Returns a list of windows managed by the notebook.tabsr'r#rcrhrrr'r'r(rsz Notebook.tabscCs|jd|jdS)aEnable 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::enableTraversalNrrr'r'r(enable_traversalszNotebook.enable_traversal)N)N)N)rrrrrxrrrrrrrrrrr'r'r'r(r s   c@s>eZdZdZd ddZejjZddZd ddZ d d d Z dS)r zfTtk Panedwindow widget displays a number of subwindows, stacked either vertically or horizontally.NcKst||d|dS)zConstruct a Ttk Panedwindow with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, width, height PANE OPTIONS weight zttk::panedwindowNrrr'r'r(rxszPanedwindow.__init__cKs"|jj|jd||ft|dS)zInserts 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.rNrrr'r'r(rszPanedwindow.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.Npaner)rwrrrFr'r'r(rszPanedwindow.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.sashposr)rwrZnewposr'r'r(rszPanedwindow.sashpos)N)N)N) rrrrrxrvr rrrrr'r'r'r(r s   c@s6eZdZdZd ddZd ddZd ddZd 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)zConstruct a Ttk Progressbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, length, mode, maximum, value, variable, phase zttk::progressbarNrrr'r'r(rxs zProgressbar.__init__cCs|j|jd|dS)zBegin autoincrement mode: schedules a recurring timer event that calls method step every interval milliseconds. interval defaults to 50 milliseconds (20 steps/second) if omitted.startNr)rwZintervalr'r'r(rszProgressbar.startcCs|j|jd|dS)zRIncrements the value option by amount. amount defaults to 1.0 if omitted.stepNr)rwZamountr'r'r(rszProgressbar.stepcCs|j|jddS)zVStop autoincrement mode: cancels any recurring timer event initiated by start.stopNrrr'r'r(rszProgressbar.stop)N)N)N)rrrrrxrrrr'r'r'r(r s    c@s"eZdZdZdddZddZdS)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::radiobuttonNrrr'r'r(rx s zRadiobutton.__init__cCs|j|jdS)zSets 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.rrrr'r'r(rszRadiobutton.invoke)Nrr'r'r'r(rs c@s.eZdZdZd ddZd ddZd ddZdS) rzTtk Scale widget is typically used to control the numeric value of a linked variable that varies uniformly over some range.NcKst||d|dS)zConstruct a Ttk Scale with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, from, length, orient, to, value, variable z ttk::scaleNrrr'r'r(rx's zScale.__init__cKsTtj||f|}t|tdtfs,||td|kd|kd|kgrP|d|S)zModify or query scale options. Setting a value for any of the "from", "from_" or "to" options generates a <> event.NrCfrom_to<>)rrQr*typer[updateanyZevent_generate)rwZcnfrFZretvalr'r'r(rQ5s   zScale.configurecCs|j|jd||S)zGet 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"rrr'r'r(r"Bsz Scale.get)N)N)NN)rrrrrxrQr"r'r'r'r(r#s  c@seZdZdZdddZdS)rz;Ttk Scrollbar controls the viewport of a scrollable widget.NcKst||d|dS)zConstruct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient zttk::scrollbarNrrr'r'r(rxNs zScrollbar.__init__)Nrr'r'r'r(rKsc@seZdZdZdddZdS)rzITtk Separator widget displays a horizontal or vertical separator bar.NcKst||d|dS)zConstruct a Ttk Separator with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient zttk::separatorNrrr'r'r(rx`s zSeparator.__init__)Nrr'r'r'r(r\sc@seZdZdZdddZdS)rzlTtk Sizegrip allows the user to resize the containing toplevel window by pressing and dragging the grip.NcKst||d|dS)zConstruct a Ttk Sizegrip with parent master. STANDARD OPTIONS class, cursor, state, style, takefocus z ttk::sizegripNrrr'r'r(rxrszSizegrip.__init__)Nrr'r'r'r(rnsc@s"eZdZdZdddZddZdS)rzTtk 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::spinboxNrrr'r'r(rxs zSpinbox.__init__cCs|j|jd|dS)z'Sets the value of the Spinbox to value.rNrrr'r'r(rsz Spinbox.set)N)rrrrrxrr'r'r'r(r|s c@s4eZdZdZdEddZdFddZdGddZd d ZdHd d Zd dZ ddZ ddZ dIddZ dJddZ ddZddZddZddZdd Zd!d"ZdKd#d$ZdLd%d&Zd'd(ZeZd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Z d;d<Z!dMd=d>Z"dNd?d@Z#dOdAdBZ$dPdCdDZ%dS)QrzTtk 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)aConstruct 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::treeviewNrrr'r'r(rxszTreeview.__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.rr8r)rwitemcolumnr'r'r(rsz Treeview.bboxcCs"|j|j|jd|pdpdS)zhReturns a tuple of children belonging to item. If item is not specified, returns root children.rJr8r'rrwrr'r'r( get_childrenszTreeview.get_childrencGs|j|jd||dS)zReplaces 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.rJNr)rwrZ newchildrenr'r'r( set_childrenszTreeview.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.Nrr)rwrrrFr'r'r(rszTreeview.columncGs|j|jd|dS)z_Delete all specified items and all their descendants. The root item may not be deleted.deleteNrrwr1r'r'r(rszTreeview.deletecGs|j|jd|dS)zUnlinks 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.detachNrrr'r'r(rszTreeview.detachcCs|j|j|jd|S)zSReturns True if the specified item is present in the tree, False otherwise.existsrrr'r'r(rszTreeview.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.focusrrr'r'r(rszTreeview.focuscKsP|d}|r,t|ts,|j||j|d<|dk rt|dkr&t|dttfr&|d}|j|jd||dS)Nr7rr)r:r*r,r+r#rhr)rwZselopr1r'r'r( _selectionszTreeview._selectioncGs|d|dS)z.The specified items becomes the new selection.rNrrr'r'r( selection_setszTreeview.selection_setcGs|d|dS)z0Add all of the specified items to the selection.rNrrr'r'r( selection_addszTreeview.selection_addcGs|d|dS)z5Remove all of the specified items from the selection.removeNrrr'r'r(selection_removeszTreeview.selection_removecGs|d|dS)z2Toggle the selection state of each specified item.ZtoggleNrrr'r'r(selection_toggleszTreeview.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.rNF)Z cut_minusrg)r#rhrrri)rwrrr-rfr'r'r(rsz Treeview.setcCs |j|jdd|f||dddS)zBind 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.tagbindr)rN)Z_bindr)rwtagnameZsequencerr'r'r(tag_bindszTreeview.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.NrrQr)rwrrrFr'r'r( tag_configures zTreeview.tag_configurec CsF|dkr$|j|j|jdd|S|j|j|jdd||SdS)zIf 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.6NrZhas)r#rcrhrr)rwrrr'r'r(tag_hasszTreeview.tag_has)N)N)N)N)N)N)N)N)NN)NN)N)N)&rrrrrxrrrrrrrrrrrrrrrrrrZreattachrrrrrrrrrrrrrrr'r'r'r(rsF              csLeZdZdZdddZfddZd d Zed d Zej d d ZZ S)rzA 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|dddk|_tj||f||p.t||_|j|||_t ||_ t ||j||d|_ |j d|j|jr|dnd}|dkrdnd}|j j|ddt |}|j|d||j j|dkrd nd d |jd |j|_| d |j| d|jdS)aConstruct 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'. Zcompoundtop)variablerrrZbottomrr)sideZfill)rrrW)Zanchorwz zN)pop _label_toprrxrvZIntVar _variabler _last_validrlabelrscaler_adjustZpacklowerZplaceZtrace_variable_LabeledScale__tracecb) rwr&rrrrFZ scale_sideZ label_sideZdummyr'r'r(rxs$    zLabeledScale.__init__csHz|jd|jWntk r(YnX|`td|_d|_dS)z9Destroy this widget and possibly its associated variable.rN)rZ trace_vdeleterAttributeErrorsuperdestroyrrr __class__r'r(r s zLabeledScale.destroycsfdd}tjd}tjd}||kr:||}}j}||krX|ksfnj_dS|_|jd<|dS)z1Adjust the label position according to the scale.csZj\}}jr2jj}njj}jj||ddS)Nrrr)Zupdate_idletasksrZcoordsrZwinfo_yrZwinfo_reqheightZplace_configurer rr'r( adjust_labels z*LabeledScale._adjust..adjust_labelrCrNtext)rsrrr"rr-rZ after_idle)rwrEr rrZnewvalr'rr(rs    zLabeledScale._adjustcCs |jS)zReturn current scale value.)rr"rr'r'r(r-4szLabeledScale.valuecCs|j|dS)zSet new scale value.N)rr)rwr=r'r'r(r-9s)NNrr) rrrrrxrrpropertyr-setter __classcell__r'r'r r(rs &  cs<eZdZdZd ddZddZd ddZfd d ZZS) rzmThemed OptionMenu, based after tkinter's OptionMenu, which allows the user to select a value from a menu.NcOs||dd|ddd}tj||f|tj|dd|d<||_|dd|_|rptd 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{rF)Ztearoffmenurzunknown option -%s) rr rxrvZMenur _callbackZTclErrorrr\keysset_menu)rwr&rrvalueskwargsrFr'r'r(rxCs  zOptionMenu.__init__cCs&|dkr|t||St||S)Nr)Z nametowidgetr __getitem__rr'r'r(r`szOptionMenu.__getitem__cGsR|d}|dd|D]$}|j|t|j||j|jdq|rN|j|dS)zUBuild a new menu of radiobuttons with *values and optionally a default value.rrend)rrrN)rZadd_radiobuttonrvZ_setitrrr)rwrrrr=r'r'r(rgs zOptionMenu.set_menucs,z|`Wntk rYnXtdS)z0Destroy this widget and its associated variable.N)rrrrrr r'r(rus zOptionMenu.destroy)N)N) rrrrrxrrrrr'r'r r(r?s   )F)FN)F)F)rrB)N)6r __version__ __author____all__rvrrrrZ TkVersionrr)r/r6r>r@rIrLrYrarerkrorsrirrobjectrrrrrrrrrrr r r r r rrrrrrZXViewZYViewrrrr'r'r'r(s     % 1*   *B*"8*(J`