當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。