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


Python tkinter.Scale方法代码示例

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


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

示例1: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, master, gui):
        super().__init__(master, text="output: Tremolo")
        self.gui = gui
        self.input_waveform = tk.StringVar()
        self.input_waveform.set("<off>")
        self.input_rate = tk.DoubleVar()
        self.input_depth = tk.DoubleVar()
        self.input_rate.set(5)
        self.input_depth.set(80)
        row = 0
        tk.Label(self, text="waveform").grid(row=row, column=0)
        values = ["<off>", "sine", "triangle", "sawtooth", "square"]
        menu = tk.OptionMenu(self, self.input_waveform, *values)
        menu["width"] = 10
        menu.grid(row=row, column=1)
        row += 1
        tk.Label(self, text="rate").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_rate, from_=0.0, to=10.0, resolution=.1,
                 width=10, length=100).grid(row=row, column=1)
        row += 1
        tk.Label(self, text="depth").grid(row=row, column=0, sticky=tk.E)
        tk.Scale(self, orient=tk.HORIZONTAL, variable=self.input_depth, from_=0.0, to=1.0, resolution=.02,
                 width=10, length=100).grid(row=row, column=1) 
开发者ID:irmen,项目名称:synthesizer,代码行数:25,代码来源:keyboard_gui.py

示例2: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, master, im, value=128):
        tkinter.Frame.__init__(self, master)

        self.image = im
        self.value = value

        self.canvas = tkinter.Canvas(self, width=im.size[0], height=im.size[1])
        self.backdrop = ImageTk.PhotoImage(im)
        self.canvas.create_image(0, 0, image=self.backdrop, anchor=tkinter.NW)
        self.canvas.pack()

        scale = tkinter.Scale(self, orient=tkinter.HORIZONTAL, from_=0, to=255,
                              resolution=1, command=self.update_scale,
                              length=256)
        scale.set(value)
        scale.bind("<ButtonRelease-1>", self.redraw)
        scale.pack()

        # uncomment the following line for instant feedback (might
        # be too slow on some platforms)
        # self.redraw() 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:23,代码来源:thresholder.py

示例3: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, master, image, name, enhancer, lo, hi):
        tkinter.Frame.__init__(self, master)

        # set up the image
        self.tkim = ImageTk.PhotoImage(image.mode, image.size)
        self.enhancer = enhancer(image)
        self.update("1.0")  # normalize

        # image window
        tkinter.Label(self, image=self.tkim).pack()

        # scale
        s = tkinter.Scale(self, label=name, orient=tkinter.HORIZONTAL,
                  from_=lo, to=hi, resolution=0.01,
                  command=self.update)
        s.set(self.value)
        s.pack() 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:19,代码来源:enhancer.py

示例4: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, root, imagesList, final_img_size):
        super(SliderGalleryFrame, self).__init__(root)
        self.master.minsize(width=100, height=100)
        self.master.config()

        self.master.bind('<Left>', self.left_key)
        self.master.bind('<Right>', self.right_key)

        self.main_frame = tk.Frame()
        self.main_frame.pack(fill='both', expand=True)

        self.imagesList = imagesList

        self.panel = tk.Label(root, image=self.imagesList[0])
        self.panel.pack(side="bottom", fill="both", expand="yes")

        self.var = tk.IntVar()
        self.scale = tk.Scale(root, from_=0, to=len(imagesList) - 1, variable=self.var, orient=tk.HORIZONTAL,
                         command=self.sel, width=20, length=final_img_size)
        self.scale.pack(anchor=tk.N)

        self.pack() 
开发者ID:Tetraquark,项目名称:pubgheatmap,代码行数:24,代码来源:slider_gallery_frame.py

示例5: set_potential_sliders

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def set_potential_sliders(self) -> None:
        """
        Set the sliders for the parameters that control
        the potential function.
        """
        for i in range(len(self.V_params)):
            self.sliders2.append(
                tk.Scale(self.window, 
                         label="change %s: " % str(self.V_params[i][0]),
                         from_=-2, to=2,
                         resolution=0.01,
                         orient=tk.HORIZONTAL,
                         length=200,
                         command=self.update_potential_by_slider
                         )
            )
            self.sliders2[i].grid(
                row=17 + self.sliders2_count + self.sliders1_count, 
                column=3, columnspan=2, 
                sticky=tk.N+tk.W+tk.E, padx=(10, 10)
            )
            self.sliders2[i].set(self.V_params[i][1])
            self.sliders2_count += 1 
开发者ID:marl0ny,项目名称:QM-Simulator-1D,代码行数:25,代码来源:app.py

示例6: makeTimeSlider

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def makeTimeSlider(self):
        self.timeSlider = tk.Scale(self, from_=self.startValue, to=self.endValue, orient=tk.constants.HORIZONTAL, 
                                   showvalue=0, command=self.timeChanged, bigincrement=60)
        self.timeSlider.configure(background="black", foreground="white", sliderrelief=tk.constants.FLAT, troughcolor="white", 
                                  activebackground="grey", relief=tk.constants.FLAT, highlightthickness=0, sliderlength=15)
        self.timeSlider.grid(row="1", column="2", sticky="we")
        self.timeSlider.bind("<Button>", lambda e: self.pauseButtonRelease(e) if not self.mainWindow.characterDetector.playbackLogReader.paused else False)
        self.timeSlider.bind("<Key>", lambda e: self.pauseButtonRelease(e) if not self.mainWindow.characterDetector.playbackLogReader.paused else False)
        self.timeSlider.focus_set()
        #self.timeSlider.bind("<ButtonRelease-1>", lambda e: True if not self.mainWindow.characterDetector.playbackLogReader.paused else self.pauseButtonRelease(e)) 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:12,代码来源:playbackFrame.py

示例7: create_scale

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def create_scale(self,setting,pos):
    f = tk.Frame(self.root)
    f.grid(row=pos+2,column=1,sticky=tk.E+tk.W)
    if type(setting.limits[0]) is float:
      step = (setting.limits[1]-setting.limits[0])/1000
    else:
      step = 1 # To go through all possible int values
    tk.Label(f,text=setting.name).pack()
    self.scales[setting.name] = tk.Scale(f,orient='horizontal',
        resolution=step, length=self.scale_length,
        from_=setting.limits[0],to=setting.limits[1])
    self.scales[setting.name].pack()
    self.scales[setting.name].set(setting.value) 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:15,代码来源:cameraConfig.py

示例8: add_scale

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def add_scale(self, **kwargs):
    """
    To add a scrollbar
    """
    widgets_dict = kwargs.pop('widgets_dict', None)
    frame = kwargs.pop('frame', None)
    name = kwargs.pop('name', 'Button')
    boundaries = kwargs.pop("boundaries", (0, 1))

    widgets_dict[name] = tk.Scale(frame,
                                  from_=boundaries[0],
                                  to_=boundaries[1],
                                  orient=tk.HORIZONTAL,
                                  ) 
开发者ID:LaboratoireMecaniqueLille,项目名称:crappy,代码行数:16,代码来源:frame_objects.py

示例9: draw_slider

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def draw_slider(self):
        # scale to choose iteration to view
        self.w = Tk.Scale(
            self.options_frame,
            from_=0, to=self.num_iters - 1,
            orient=Tk.HORIZONTAL,
            resolution=1,
            font=tkFont.Font(family="Helvetica", size=10),
            command=self.update_graphs,
            length=200)

        if self.curr_pos == self.num_iters - 1 or self.curr_pos == 0 or self.var_ref.get():
            self.curr_pos = self.num_iters - 1
        self.w.set(self.curr_pos)
        self.w.grid(row=0, column=1, padx=5, sticky=Tk.W) 
开发者ID:mdolab,项目名称:OpenAeroStruct,代码行数:17,代码来源:plot_wingbox.py

示例10: init_main_window

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def init_main_window():
    """
    Инициализация главного окна: создание всех необходимых виджетов и их упаковка.
    :return:
    """
    global root, button1, button2, label, text, scale

    root = tkinter.Tk()

    button1 = tkinter.Button(root, text="Button 1", command=button1_command)
    button1.bind("<Button>", print_hello)

    button2 = tkinter.Button(root, text="Button 2")
    button2.bind("<Button>", print_hello)

    variable = tkinter.IntVar(0)
    label = tkinter.Label(root, textvariable=variable)
    scale = tkinter.Scale(root, orient=tkinter.HORIZONTAL, length=300,
                          from_=0, to=100, tickinterval=10, resolution=5, variable=variable)
    text = tkinter.Entry(root, textvariable=variable)

    for obj in button1, button2, label, scale, text:
        obj.pack() 
开发者ID:tkhirianov,项目名称:kpk2016,代码行数:25,代码来源:widgets_testing.py

示例11: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent)
        self.af_on = tk.IntVar(value=0)
        self.af_on_cb = tk.Checkbutton(self, text="AF Threshold", variable=self.af_on)
        self.af_on_cb.grid(row=0, column=0, padx=3, columnspan=2, sticky=tk.EW)
        self.af_var = tk.DoubleVar()
        self.af_gt_lt = tk.IntVar(value=1)
        self.af_lt_radio_button = tk.Radiobutton(self, text="<", variable=self.af_gt_lt, value=1)
        self.af_lt_radio_button.grid(row=1, column=0, sticky=tk.EW)
        self.af_gt_radio_button = tk.Radiobutton(self, text=">", variable=self.af_gt_lt, value=2)
        self.af_gt_radio_button.grid(row=1, column=1, sticky=tk.EW)

        self.af_scale = tk.Scale(self, variable=self.af_var, from_=float(0), to=float(1), resolution=float(0.01),
                                 orient=tk.HORIZONTAL)
        self.af_scale.grid(row=2, column=0, padx=3, sticky=tk.EW, columnspan=2) 
开发者ID:VCCRI,项目名称:SVPV,代码行数:17,代码来源:gui_widgets.py

示例12: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, master):
        self.master = master
        self.master.title('PID tuner Crazyflie')

        self.figplot = plt.Figure(figsize=(5, 4), dpi=100)
        self.ax2 = self.figplot.add_subplot(111)
        self.line2 = FigureCanvasTkAgg(self.figplot, self.master)
        self.line2.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)

        self.scale_Kp = tk.Scale(master, label='scale_Kp', from_=0, to=20,
                                 length=600, tickinterval=2, resolution=0.1,
                                 orient=tk.HORIZONTAL)
        self.scale_Ki = tk.Scale(master, label='scale_Ki', from_=0, to=10,
                                 length=600, tickinterval=1, resolution=0.1,
                                 orient=tk.HORIZONTAL)
        self.scale_Kd = tk.Scale(master, label='scale_Kd', from_=0, to=10,
                                 length=600, tickinterval=1, resolution=0.1,
                                 orient=tk.HORIZONTAL)

        self.scale_Kp.pack()
        self.scale_Ki.pack()
        self.scale_Kd.pack()

        self.pos_array_prev = []
        self.sp_array_prev = []
        self.time_array_prev = [] 
开发者ID:bitcraze,项目名称:crazyflie-lib-python,代码行数:28,代码来源:PID_controller_tuner.py

示例13: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.chosenFile = None
        self.chosenFilePath = tk.StringVar()

        self.pathField = tk.Entry(self, width=40, textvariable=self.chosenFilePath, state=tk.DISABLED)
        self.pathField.grid(row=0, column=0, padx=10)

        self.selectFile = tk.Button(self, text="Choose file...", command=self.choose_a_file)
        self.selectFile.grid(row=0, column=1)

        self.groupFrame = tk.LabelFrame(self, text="Params", padx=5, pady=5)
        self.groupFrame.grid(row=1, column=0, columnspan=2, )

        self.colorPaletteLabel = tk.Label(self.groupFrame, text = 'Color Palette')
        self.colorPaletteLabel.grid(row=0, column=0 )

        self.colorPalette = ttk.Combobox(self.groupFrame)
        self.colorPalette['values'] = LEGO_PALETTE
        self.colorPalette.current(0)
        self.colorPalette.grid(row=0, column=1)

        self.brickNumberScale = tk.Scale(self.groupFrame, from_=1, to=200, orient=tk.HORIZONTAL, label="Number of bricks (longer edge)", length=250)
        self.brickNumberScale.set(30)
        self.brickNumberScale.grid(row=1, column=0, columnspan=2, )

        self.convertFile = tk.Button(text="Legofy this image!", command=self.convert_file)
        self.convertFile.grid(row=2, column=0, columnspan=2) 
开发者ID:JuanPotato,项目名称:Legofy,代码行数:31,代码来源:legofy_gui.py

示例14: __init__

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def __init__(self, master=None, **kw):
        """Construct a Ttk Scale with parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus

        WIDGET-SPECIFIC OPTIONS

            command, from, length, orient, to, value, variable
        """
        Widget.__init__(self, master, "ttk::scale", kw) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:14,代码来源:ttk.py

示例15: create

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Scale [as 别名]
def create(self, **kwargs):
        return tkinter.Scale(self.root, **kwargs) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:4,代码来源:test_widgets.py


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