当前位置: 首页>>代码示例>>Python>>正文


Python Scale.configure方法代码示例

本文整理汇总了Python中Tkinter.Scale.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Scale.configure方法的具体用法?Python Scale.configure怎么用?Python Scale.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tkinter.Scale的用法示例。


在下文中一共展示了Scale.configure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Logplayer

# 需要导入模块: from Tkinter import Scale [as 别名]
# 或者: from Tkinter.Scale import configure [as 别名]
class Logplayer(Frame):
    def __init__(self, root, logfn, viewer, analyzator=None, logdir=None, **kwargs):
        self.root=root
        self.logdir = logdir
        self.analyzator = analyzator
        if not self.logdir:
            self.logdir=os.path.join(os.path.dirname(os.path.dirname(__file__)),'log')
        Frame.__init__(self, **kwargs)
        self.view=viewer(self, x=800, y=600, onLeft=self.clickL, onRight=self.clickR)
        self.createWidgets()
        self.bind_all("<Left>", self.prev)
        self.bind_all("<Right>", self.next)

        self.view.redraw()
        self.root.update()
        if not logfn:
            logfn = self.logSelectDialog()
        self.dirname, self.filename = os.path.split(logfn)
        self.startRun(logfn,0)
        self.view.redraw()
        self.root.after(10,self.view.zoomExtens)
        self.running=False

    def logSelectDialog(self):
            self.root.update()
            timestamps, dirs, fns = zip(*sorted(listdir(self.logdir), reverse=True))
            o=SelcectDialog(self.root, "select log", timestamps)
            self.root.wait_window(o.top)
            index=timestamps.index(o.option)
            return os.path.join(dirs[index], fns[index])

    def createWidgets(self):
        self.controlFrame=Frame(self)
        self.posScale = Scale(self.controlFrame, orient='horizontal',
                           length=210,
                           from_=0, tickinterval=0,
                           command=self.pos_callback,
                           showvalue=0,sliderlength=10, resolution=1)
        #self.posScale.bind('<Button-1>',self.pos_start_drag)
        #self.posScale.bind('<ButtonRelease-1>', self.pos_set)

        self.playB=Button(self.controlFrame, text="play", command=self.playToggle)
        self.nextB=Button(self.controlFrame, text="next", command=self.nextRun)
        self.prevB=Button(self.controlFrame, text="prev", command=self.prevRun)
        self.camera=tkimg(self, width=640, height=512)
        self.controlFrame.grid(row=0,column=1, sticky="nw")
        self.view.grid(row=1, column=1, sticky="nsew")
        self.grid_columnconfigure(1,weight=1)
        self.grid_rowconfigure(1,weight=1)
        self.camera.grid(row = 1, column = 2, sticky = 'ne')
        self.playB.grid(row=0, column=1)
        self.prevB.grid(row=0, column=2)
        self.nextB.grid(row=0, column=3)
        self.posScale.grid(row=0, column=0)


    def playToggle(self, *args):
        if self.running:
            self.root.after_cancel(self.cycleId)
        else:
            self.cycleId=self.root.after(20, self.showrun)
        self.running=not self.running

    def nextRun(self, *args):
        self.changeRun(1)

    def prevRun(self, *args):
        self.changeRun(-1)

    def changeRun(self, step):
        if self.running:
            self.root.after_cancel(self.cycleId)
            self.running=False
        run=self.loggenerator.run+step
        if run >= len(self.loggenerator.runconfig) or run<0:
            timestamps, dirs, fns = zip(*sorted(listdir(self.logdir)))
            index=fns.index(self.filename)+step
            if 0<=index<len(fns):
                run = 0 if step==1 else -1
                self.startRun(os.path.join(dirs[index], fns[index]), run)
        else:
            self.startRun(os.path.join(self.dirname, self.filename), run)




    def restart(self, keeppostion=True, startposition=None):
        self.loggenerator.startrun(self.loggenerator.run, startposition=startposition)
        self.data=list(self.loggenerator)
        if not keeppostion:
            self.position=0
        self.posScale.set(self.position)
        self.showData(self.position)

    def startRun(self, fn, run, keeppostion=False):
        self.dirname, self.filename = os.path.split(fn)
        print("starting log %s run %i"%(fn,run))
        self.loggenerator=EduroMaxiReader(fn)
        self.loggenerator.startrun(run)
        self.root.title("%s %s run %i"%(self.dirname,self.filename, self.loggenerator.run+1))
#.........这里部分代码省略.........
开发者ID:robotika,项目名称:eduro,代码行数:103,代码来源:logplayer.py

示例2: __init__

# 需要导入模块: from Tkinter import Scale [as 别名]
# 或者: from Tkinter.Scale import configure [as 别名]
class Tool_Path_Generator:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#e6e6e6'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        font11 = "-size 15 -weight normal -slant roman "  \
            "-underline 0 -overstrike 0"

        self.axial_length = DoubleVar()
        self.printbed_diameter = DoubleVar()
        self.final_diameter = DoubleVar()
        self.filament_width_og = DoubleVar()
        self.helix_angle = DoubleVar()
        self.smear_factor = DoubleVar()
        self.flow_rate = DoubleVar()
        self.uv_offset = DoubleVar()
        self.use_strong_pattern = BooleanVar()

        self.axial_length.set(200.0)
        self.printbed_diameter.set(10.0)
        self.final_diameter.set(15.0)
        self.filament_width_og.set(0.41)
        self.helix_angle.set(45.0)
        self.smear_factor.set(100.0)
        self.flow_rate.set(0.0015)
        self.uv_offset.set(32.5)
        self.use_strong_pattern.set(True)

        top.geometry("700x550")
        top.title("SkelePrint Tool Path Generator")
        top.configure(background="#e6e6e6")
        top.configure(highlightbackground="#e6e6e6")
        top.configure(highlightcolor="black")

        self.Label7 = Label(top)
        self.Label7.grid(row=0, column=0, sticky=W)
        self.Label7.configure(background="#e6e6e6")
        self.Label7.configure(font=font11)
        self.Label7.configure(foreground="#000000")
        self.Label7.configure(text='''SkelePrint Tool Path Generator''')

        self.Labelframe1 = LabelFrame(top)
        self.Labelframe1.grid(row=1, column=0, sticky=N+S)
        self.Labelframe1.configure(relief=GROOVE)
        self.Labelframe1.configure(foreground="black")
        self.Labelframe1.configure(text='''Dimensions''')
        self.Labelframe1.configure(background="#e6e6e6")
        self.Labelframe1.configure(highlightbackground="#e6e6e6")
        self.Labelframe1.configure(highlightcolor="black")

        self.axial_length_entry = Entry(self.Labelframe1)
        self.axial_length_entry.grid(row=0, column=1)
        self.axial_length_entry.configure(background="white")
        self.axial_length_entry.configure(font="TkFixedFont")
        self.axial_length_entry.configure(foreground="#000000")
        self.axial_length_entry.configure(highlightbackground="#e6e6e6")
        self.axial_length_entry.configure(highlightcolor="black")
        self.axial_length_entry.configure(insertbackground="black")
        self.axial_length_entry.configure(selectbackground="#c4c4c4")
        self.axial_length_entry.configure(selectforeground="black")
        self.axial_length_entry.configure(textvariable=self.axial_length)

        self.Label1 = Label(self.Labelframe1)
        self.Label1.grid(row=0, column=0, sticky=E)
        self.Label1.configure(activebackground="#e6e6e6")
        self.Label1.configure(activeforeground="black")
        self.Label1.configure(background="#e6e6e6")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(highlightbackground="#e6e6e6")
        self.Label1.configure(highlightcolor="black")
        self.Label1.configure(text='''Axial Length''')

        self.Label2 = Label(self.Labelframe1)
        self.Label2.grid(row=0, column=2, sticky=W)
        self.Label2.configure(activebackground="#e6e6e6")
        self.Label2.configure(activeforeground="black")
        self.Label2.configure(background="#e6e6e6")
        self.Label2.configure(disabledforeground="#e6e6e6")
        self.Label2.configure(foreground="#000000")
        self.Label2.configure(highlightbackground="#e6e6e6")
        self.Label2.configure(highlightcolor="black")
        self.Label2.configure(text='''mm''')

        self.Label3 = Label(self.Labelframe1)
        self.Label3.grid(row=1, column=0, sticky=E)
        self.Label3.configure(activebackground="#e6e6e6")
        self.Label3.configure(activeforeground="black")
        self.Label3.configure(background="#e6e6e6")
        self.Label3.configure(foreground="#000000")
        self.Label3.configure(highlightbackground="#e6e6e6")
        self.Label3.configure(highlightcolor="black")
        self.Label3.configure(text='''Printbed Diameter''')

        self.Entry2 = Entry(self.Labelframe1)
        self.Entry2.grid(row=1, column=1)
        self.Entry2.configure(background="white")
        self.Entry2.configure(font="TkFixedFont")
        self.Entry2.configure(foreground="#000000")
        self.Entry2.configure(highlightbackground="#e6e6e6")
#.........这里部分代码省略.........
开发者ID:tkkuehn,项目名称:skeleprint_ui,代码行数:103,代码来源:tpg_gui.py


注:本文中的Tkinter.Scale.configure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。