Python tkinter.ttk 模块,Scale() 实例源码

我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用tkinter.ttk.Scale()

项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def checkParam(self, widget, name, value, *, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def test_keys(self):
        widget = self.create()
        keys = widget.keys()
        # XXX
        if not isinstance(widget, Scale):
            self.assertEqual(sorted(keys), sorted(widget.configure()))
        for k in keys:
            widget[k]
        # Test if OPTIONS contains all keys
        if test.support.verbose:
            aliases = {
                'bd': 'borderwidth',
                'bg': 'background',
                'fg': 'foreground',
                'invcmd': 'invalidcommand',
                'vcmd': 'validatecommand',
            }
            keys = set(keys)
            expected = set(self.OPTIONS)
            for k in sorted(keys - expected):
                if not (k in aliases and
                        aliases[k] in keys and
                        aliases[k] in expected):
                    print('%s.OPTIONS doesn\'t contain "%s"' %
                          (self.__class__.__name__, k))
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def checkParam(self, widget, name, value, *, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def test_keys(self):
        widget = self.create()
        keys = widget.keys()
        # XXX
        if not isinstance(widget, Scale):
            self.assertEqual(sorted(keys), sorted(widget.configure()))
        for k in keys:
            widget[k]
        # Test if OPTIONS contains all keys
        if test.support.verbose:
            aliases = {
                'bd': 'borderwidth',
                'bg': 'background',
                'fg': 'foreground',
                'invcmd': 'invalidcommand',
                'vcmd': 'validatecommand',
            }
            keys = set(keys)
            expected = set(self.OPTIONS)
            for k in sorted(keys - expected):
                if not (k in aliases and
                        aliases[k] in keys and
                        aliases[k] in expected):
                    print('%s.OPTIONS doesn\'t contain "%s"' %
                          (self.__class__.__name__, k))
项目:StochOPy    作者:keurfonluu    | 项目源码 | 文件源码
def _scale(self, from_, to, resolution, variable, position, command = None,
               kwargs = {}):
        if command is None:
            command = lambda s: variable.set(round(float(s), 3))
        scale = ttk.Scale(self.frame1.sliders, from_ = from_, to = to, variable = variable,
                          orient = "horizontal", length = 20, command = command,
                          takefocus = False, **kwargs)
        if position == 1:
            scale.place(relwidth = 0.35, relx = 0, x = 0, y = 25, anchor = "nw")
        elif position == 2:
            scale.place(relwidth = 0.35, relx = 0, x = 0, y = 70, anchor = "nw")
        elif position == 3:
            scale.place(relwidth = 0.35, relx = 0.5, x = 0, y = 25, anchor = "nw")
        elif position == 4:
            scale.place(relwidth = 0.35, relx = 0.5, x = 0, y = 70, anchor = "nw")
        return scale
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def checkParam(self, widget, name, value, *, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def checkParam(self, widget, name, value, *, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq)
项目:stash-scanner    作者:senuido    | 项目源码 | 文件源码
def __init__(self, master, **kw):
        super().__init__(master)

        # self.grid_propagate(0)
        # self.columnconfigure(0, weight=1)
        # self.rowconfigure(0, weight=1)

        self.var = kw.get('variable', IntVar())
        kw['variable'] = self.var
        kw['from_'] = ConfidenceLevel.Low.value
        kw['to'] = ConfidenceLevel.VeryHigh.value
        # kw['command'] = self.scale_change
        kw['orient'] = HORIZONTAL

        self.lbl_scale = Label(self)
        self.scale = Scale(self, **kw)

        self.scale_font = tkfont.nametofont(Style().lookup('TLabel', 'font')).copy()
        self.scale_font.config(weight=tkfont.BOLD, size=9)
        self.lbl_scale.config(font=self.scale_font, width=3, anchor=CENTER)
        self.var.trace_variable('w', lambda a, b, c: self.scale_change())

        self.scale.grid(row=0, column=0, sticky='ns')
        self.lbl_scale.grid(row=0, column=1, sticky='ns', padx=(3, 0))
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs)
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, from_=0, to=0, *args):
        ttk.Scale.__init__(self, parent, command=self._round, from_=from_, to=to, *args)
        self.parent = parent
        self._from = from_
        self._to = to

        self._value = self.get()
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def _round(self, *args):
        """Rounds the Scale."""
        self._value = self.get()
        if int(self._value) != self._value:
            self.set(round(self._value))

##################################################
项目:pkinter    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args):
        ttk.Scale.__init__(self, parent, from_=0, to=1, *args)
        self.parent = parent

        self._variable = tk.DoubleVar()
        self.configure(variable=self._variable)

        self.bind("<ButtonRelease-1>", self._activate, "+")
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def setUp(self):
        support.root_deiconify()
        self.scale = ttk.Scale()
        self.scale.pack()
        self.scale.update()
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs)
项目:Python-Media-Player    作者:surajsinghbisht054    | 项目源码 | 文件源码
def create_control_panel(self):
        frame=Tkinter.LabelFrame(self.root)
        frame.pack(expand='yes',fill='x',side='top')
        add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif")
        add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif")
        exiticon=Tkinter.PhotoImage(file="../Icons/exit.gif")
        playicon=Tkinter.PhotoImage(file="../Icons/play.gif")
        pauseicon=Tkinter.PhotoImage(file="../Icons/pause.gif")
        stopicon=Tkinter.PhotoImage(file="../Icons/stop.gif")
        rewindicon=Tkinter.PhotoImage(file="../Icons/rewind.gif")
        fast_forwardicon=Tkinter.PhotoImage(file="../Icons/fast_forward.gif")
        previous_trackicon=Tkinter.PhotoImage(file="../Icons/previous_track.gif")
        next_trackicon=Tkinter.PhotoImage(file="../Icons/next_track.gif")
        self.muteicon=Tkinter.PhotoImage(file="../Icons/mute.gif")
        self.unmuteicon=Tkinter.PhotoImage(file="../Icons/unmute.gif")
        delete_selectedicon=Tkinter.PhotoImage(file="../Icons/delete_selected.gif")

        list_file=[
            (playicon,'self.play'),
            (pauseicon,'self.pause'),
            (stopicon,'self.stop'),
            (previous_trackicon,'self.previous'),
            (rewindicon,'self.rewind'),
            (fast_forwardicon,'self.fast'),
            (next_trackicon,'self.Next'),]
        for i,j in list_file:
            storeobj=ttk.Button(frame, image=i,command=eval(j))
            storeobj.pack(side='left')
            storeobj.image=i
        self.volume_label=Tkinter.Button(frame,image=self.unmuteicon)
        self.volume_label.image=self.unmuteicon

        volume=ttk.Scale(frame,from_=Volume_lowest_value, to=Volume_highest_value ,variable=self.var, command=self.update_volume)
        volume.pack(side='right', padx=10, )
        self.volume_label.pack(side='right')
        return
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_tk_scale(self, index: int or str="end", *args, **kwargs):
        """Insert a tk.Scale into the game."""
        widget = tk.Scale(self.text, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_ttk_scale(self, command=None, from_: int=0, length: int=100, to: int=100, value: float=0.0, variable: tk.IntVar=None, index: int or str="end", *args, **kwargs):
        """Insert a ttk.Scale into the game."""
        widget = ttk.Scale(self.text, command=command, from_=from_, length=length, to=to, value=value, variable=variable, **kwargs)
        self.text.window_create(index, window=widget)

        return widget
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs)
项目:synthesizer    作者:irmen    | 项目源码 | 文件源码
def __init__(self, master, title):
        self.title = title
        super().__init__(master, text=title, padding=4)
        self.player = None   # will be connected later
        self.volumeVar = tk.DoubleVar(value=100)
        self.volumefilter = VolumeFilter()
        ttk.Label(self, text="title / artist / album").pack()
        self.titleLabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.titleLabel.pack()
        self.artistLabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.artistLabel.pack()
        self.albumlabel = ttk.Label(self, relief=tk.GROOVE, width=22, anchor=tk.W)
        self.albumlabel.pack()
        f = ttk.Frame(self)
        ttk.Label(f, text="time left: ").pack(side=tk.LEFT)
        self.timeleftLabel = ttk.Label(f, relief=tk.GROOVE, anchor=tk.CENTER)
        self.timeleftLabel.pack(side=tk.RIGHT, fill=tk.X, expand=True)
        f.pack(fill=tk.X)
        f = ttk.Frame(self)
        ttk.Label(f, text="V: ").pack(side=tk.LEFT)
        scale = ttk.Scale(f, from_=0, to=150, length=120, variable=self.volumeVar, command=self.on_volumechange)
        scale.bind("<Double-1>", self.on_dblclick_vol)
        scale.pack(side=tk.LEFT)
        self.volumeLabel = ttk.Label(f, text="???%")
        self.volumeLabel.pack(side=tk.RIGHT)
        f.pack(fill=tk.X)
        ttk.Button(self, text="Skip", command=lambda s=self: s.player.skip(s)).pack(pady=4)
        self.volume = 100
        self.stateLabel = tk.Label(self, text="STATE", relief=tk.SUNKEN, border=1)
        self.stateLabel.pack()
        self._track = None
        self._time = None
        self._stream = None
        self._state = self.state_needtrack
        self.state = self.state_needtrack
        self.xfade_state = self.state_xfade_nofade
        self.xfade_started = None
        self.xfade_start_volume = None
        self.playback_started = None
        self.track_duration = None
项目:Spectroscope    作者:magin67    | 项目源码 | 文件源码
def SetFunctionWidgets(self, rowControl):
        ## ???????
        def SetDistortionLabel():
            self.lblDistortion.configure(text="Disturb: " + str(round(self.shSpectr.distortion, 3)))

        def SetDistortion(val=0):
            distortion = Geo.Val2Val(int(float(val)), [0, 100], [self.shSpectr.distortionRange[0], self.shSpectr.distortionRange[1]])  
            self.shSpectr.ChangeDistortion(distortion)
            SetDistortionLabel()

        def SetDegreeLabel():
            self.lblDegree.configure(text="Degree: " + str(round(self.shSpectr.degree, 2)))

        def SetDegree(val=0):
            degree = Geo.Val2Val(int(float(val)), [0, 100], [self.shSpectr.degreeRange[0], self.shSpectr.degreeRange[1]])  
            self.shSpectr.ChangeDegree(degree)
            SetDegreeLabel()

        rowControl = self.AddLabel(rowControl, "Function")

        self.lblDistortion = ttk.Label(self.frControl)
        PlaceWidget(self.lblDistortion, rowControl)

        iniDist = Geo.Val2Val(self.shSpectr.distortion, [self.shSpectr.distortionRange[0], self.shSpectr.distortionRange[1]], [0, 100])
        self.scDistortion = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=100, value=iniDist, command=SetDistortion) 
        rowControl = PlaceWidget(self.scDistortion, rowControl, colspan=2, stick='ne')
        SetDistortionLabel() 

        rowControl = self.AddLabel(rowControl, "Degree", self.lblColor, 1)

        self.lblDegree = ttk.Label(self.frControl)
        PlaceWidget(self.lblDegree, rowControl)

        iniDegree = Geo.Val2Val(self.shSpectr.degree, [self.shSpectr.degreeRange[0], self.shSpectr.degreeRange[1]], [0, 100])
        self.scDegree = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=100, value=iniDegree, command=SetDegree) 
        rowControl = PlaceWidget(self.scDegree, rowControl, colspan=2, stick='ne')
        SetDegreeLabel() 

        return self.AddLabel(rowControl)
项目:Spectroscope    作者:magin67    | 项目源码 | 文件源码
def SetBaseWidgets(self, rowControl):
        ## ???? (?????, ??????, ??????) ???????
        def SetSizeLabel():
            self.lblSpSize.configure(text="Order: " + str(self.shSpectr.Size) + ', ' + str(self.shSpectr.numSp + 1))

        def SetSpParameters():
            self.scIndex.configure(to=self.toIndex())
            self.scVMarksize.configure(to=int(self.shSpectr.numZ-1))
            self.scColor.configure(to=int(self.shSpectr.numZ-1))
            SetSizeLabel()
            self.SetIndexLabel()
            self.SetLabelVectorColor()
            self.SetLabelMSVector()

        def ChangeBaseSet(val):
            self.shSpectr.BaseSet=val
            self.shSpectr.SetForm()
            SetSpParameters()

        def ChangeSize(val):
            iSize = int(float(val))
            self.shSpectr.Size= iSize
            self.shSpectr.SetForm()
            SetSpParameters()

        def ChangeIndex(val):
            ind = int(float(val))
            self.shSpectr.ChangeIndex(ind*self.shSpectr.NumPlots)
            self.SetIndexLabel()

        rowControl = self.AddLabel(rowControl, "Base", colsp=1)

        vBaseSet = self.shSpectr.BaseSets()
        sBaseSet = tk.StringVar(self.frControl)
        self.omBaseSet = ttk.OptionMenu(self.frControl, sBaseSet, self.shSpectr.BaseSet, *vBaseSet, command=ChangeBaseSet)  
        rowControl = PlaceWidget(self.omBaseSet, rowControl, col=1, stick='wn') 

        self.lblSpSize = ttk.Label(self.frControl)
        PlaceWidget(self.lblSpSize, rowControl)
        SetSizeLabel()

        self.scSize = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=self.shSpectr.SizeRange[0], to=self.shSpectr.SizeRange[1], value=self.shSpectr.Size, command=ChangeSize)
        rowControl = PlaceWidget(self.scSize, rowControl, col=1, colspan=1, stick='ne')

        rowControl = self.AddLabel(rowControl, "Index", self.lblColor, 1)

        self.lblSpIndex = ttk.Label(self.frControl) #, text="Index: 0"
        PlaceWidget(self.lblSpIndex, rowControl)
        self.scIndex = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=self.toIndex(), value=int(self.shSpectr.iSpectr/self.shSpectr.NumPlots), command=ChangeIndex)
        rowControl = PlaceWidget(self.scIndex, rowControl, col=0, colspan=2, stick='ne')
        self.SetIndexLabel()

        return self.AddLabel(rowControl)
项目:Spectroscope    作者:magin67    | 项目源码 | 文件源码
def SetColorWidgets(self, rowControl):
        ## ????
        def CheckVectorColor(): 
            self.shSpectr.useVectorColor = useVectorColor.get()
            self.shSpectr.ShowSp()

        def ChangeColorMap(val=0):
            cmap = SD.mColorMap()[int(float(val))]
            self.shSpectr.cmap = cmap
            self.lblCmap.configure(text='Map: ' + cmap)
            self.shSpectr.ShowSp()

        def SetVColor(val=0, ini=False):
            iColor = int(float(val))
            if not ini:
                self.shSpectr.SetColor(iColor)
                self.shSpectr.ShowSp()
            self.SetLabelVectorColor()

        def InverseColor():
            self.shSpectr.inverseColor = inverseColor.get()
            self.shSpectr.ShowSp()

        def SetAlpha(val=0, ini=False):
            normAlpha = Geo.Val2Val(float(val), [0, 100], [0, 1])
            if not ini:
                self.shSpectr.SetAlpha(normAlpha)
            self.lblAlpha.configure(text="Alpha: " + str(round(normAlpha, 2)))

        rowControl = self.AddLabel(rowControl, "Color", colsp=1)

        inverseColor = tk.BooleanVar()
        inverseColor.set(False)
        self.chkInverseColor = ttk.Checkbutton(self.frControl, text="Reverse", variable=inverseColor, onvalue=True, offvalue=False, command=InverseColor)
        rowControl = PlaceWidget(self.chkInverseColor, rowControl, col=1, stick='w') 

        cmap = self.shSpectr.cmap
        self.lblCmap = ttk.Label(self.frControl, text='Map: ' + cmap)
        PlaceWidget(self.lblCmap, rowControl)
        vColorMap = SD.mColorMap()
        indCMap = vColorMap.index(cmap) 
        self.scColorMap = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=len(vColorMap)-1, value=indCMap, command=ChangeColorMap)
        rowControl = PlaceWidget(self.scColorMap, rowControl, col=1, stick='ne') 

        useVectorColor = tk.IntVar()
        useVectorColor.set(self.shSpectr.useVectorColor)
        self.chkVectorColor = ttk.Checkbutton(self.frControl, variable=useVectorColor, onvalue=True, offvalue=False, command=CheckVectorColor)
        rowControl = PlaceWidget(self.chkVectorColor, rowControl, col=0, stick='ew') 

        self.scColor = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=self.shSpectr.numZ-1, value=self.shSpectr.iColor, command=SetVColor)
        rowControl = PlaceWidget(self.scColor, rowControl, col=1, stick='ne')
        SetVColor(val=self.shSpectr.iColor, ini=True) 

        iniAlpha = Geo.Val2Val(self.shSpectr.alpha, [0, 1], [0, 100])
        self.lblAlpha = ttk.Label(self.frControl)
        PlaceWidget(self.lblAlpha, rowControl)
        self.scAlpha = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=100, value=iniAlpha, command=SetAlpha)
        rowControl = PlaceWidget(self.scAlpha, rowControl, col=1, stick='ne')
        SetAlpha(self.scAlpha.get(), True) 

        return self.AddLabel(rowControl)
项目:Spectroscope    作者:magin67    | 项目源码 | 文件源码
def SetMarkerWidgets(self, rowControl):
        ## Markers
        def ChangeMarkform(val='o'):
            self.shSpectr.mark_style = SD.dicMarkStyle()[val]
            self.shSpectr.ShowSp()

        def SetMarksizeLabel():
            self.lblMarksize.configure(text="Size: " + str(round(self.scMarksize.get(), 1)))

        def SetMarksize(val=0):
            self.shSpectr.ChangeMarksize(float(val))
            SetMarksizeLabel()

        def SetVmarksize(val=0, ini=False):
            ms = float(val)
            if not ini:
                self.shSpectr.SetMarksize(ms)
            self.SetLabelMSVector()

        def CheckMarksize():
            self.shSpectr.useVectorMarksize = useVectorMarksize.get()
            self.shSpectr.ShowSp()

        def InverseMarksize():
            self.shSpectr.inverseMarksize = inverseMarksize.get()
            self.shSpectr.ShowSp()

        rowControl = self.AddLabel(rowControl, "Markers", colsp=1)

        vsMarkStyle = list(SD.dicMarkStyle().keys())
        sMarkStyle = tk.StringVar(self.frControl)
        self.omMarkStyle = ttk.OptionMenu(self.frControl, sMarkStyle, "circle", *vsMarkStyle, command=ChangeMarkform)  
        rowControl = PlaceWidget(self.omMarkStyle, rowControl, col=1, stick='wn') 

        self.lblMarksize = ttk.Label(self.frControl)
        PlaceWidget(self.lblMarksize, rowControl)

        self.scMarksize = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, 
                from_=self.shSpectr.MarksizeRange[0], to=self.shSpectr.MarksizeRange[1], value=self.shSpectr.msize, command=SetMarksize)
        rowControl = PlaceWidget(self.scMarksize, rowControl, col=1, stick='ne')
        SetMarksizeLabel() 

        useVectorMarksize = tk.BooleanVar()
        useVectorMarksize.set(self.shSpectr.useVectorMarksize)
        self.chkMarkSize = ttk.Checkbutton(self.frControl, variable=useVectorMarksize, onvalue=True, offvalue=False, command=CheckMarksize)
        rowControl = PlaceWidget(self.chkMarkSize, rowControl, col=0, stick='ew') 

        self.scVMarksize = ttk.Scale(self.frControl, orient='horizontal', length=100, from_=0, to=self.shSpectr.numZ-1, value=self.shSpectr.iMarksize, command=SetVmarksize)
        rowControl = PlaceWidget(self.scVMarksize, rowControl, col=1, stick='ew')
        SetVmarksize(val=self.shSpectr.iMarksize, ini=True)

        inverseMarksize = tk.BooleanVar()
        inverseMarksize.set(self.shSpectr.inverseMarksize)
        self.chkInverseMarksize = ttk.Checkbutton(self.frControl, text="Reverse", variable=inverseMarksize, onvalue=True, offvalue=False, command=InverseMarksize)
        rowControl = PlaceWidget(self.chkInverseMarksize, rowControl, col=0, colspan=2, stick='wn') 

        return self.AddLabel(rowControl)
项目:Spectroscope    作者:magin67    | 项目源码 | 文件源码
def SetMaskWidgets(self, rowControl):
        ## ????? ????????????
        def ChangeMaskFunction(val='Var'):
            self.shSpectr.MaskFunction = val
            self.shSpectr.ShowSp()

        def SetMask(val=0, ini=False):
            self.shSpectr.iMask = int(float(val))
            self.chkMask.configure(text='Use: ' + str(int(self.shSpectr.iMask)))
            if not ini:
                self.shSpectr.ShowSp()

        def CheckMask():
            self.shSpectr.useMask = useMask.get()
            self.shSpectr.ShowSp()

        def InverseMask():
            self.shSpectr.inverseMask = inverseMask.get()
            self.shSpectr.ShowSp()

        rowControl = self.AddLabel(rowControl, "Mask", colsp=1)

        vsMaskFunction = ['Std', 'Mean']
        sMaskFunction = tk.StringVar(self.frControl)
        self.omMaskFunction = ttk.OptionMenu(self.frControl, sMaskFunction, "Std", *vsMaskFunction, command=ChangeMaskFunction)  
        rowControl = PlaceWidget(self.omMaskFunction, rowControl, col=1, stick='w') 

        useMask = tk.IntVar()
        useMask.set(False)
        self.chkMask = ttk.Checkbutton(self.frControl, variable=useMask, onvalue=True, offvalue=False, command=CheckMask)
        rowControl = PlaceWidget(self.chkMask, rowControl, col=0, stick='ew') 

        self.scMask = ttk.Scale(self.frControl, orient='horizontal', length=self.colWidth2, from_=0, to=100, value=self.shSpectr.iMask, command=SetMask)
        rowControl = PlaceWidget(self.scMask, rowControl, col=1, stick='ne')
        SetMask(val=self.shSpectr.iMask, ini=True) 

        inverseMask = tk.BooleanVar()
        inverseMask.set(self.shSpectr.inverseMask)
        self.chkInverseMask = ttk.Checkbutton(self.frControl, text="Inverse", variable=inverseMask, onvalue=True, offvalue=False, command=InverseMask)
        rowControl = PlaceWidget(self.chkInverseMask, rowControl, col=0, colspan=2, stick='wn') 

        return self.AddLabel(rowControl)