Spectroscope.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目: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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号