當前位置: 首頁>>代碼示例>>Python>>正文


Python Tkinter.Scale方法代碼示例

本文整理匯總了Python中Tkinter.Scale方法的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter.Scale方法的具體用法?Python Tkinter.Scale怎麽用?Python Tkinter.Scale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tkinter的用法示例。


在下文中一共展示了Tkinter.Scale方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _make_slider

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def _make_slider(self, parent, rowidx, label, inival, maxval, res=0.5):
        # Create shared variable and set initial value.
        tkvar = tk.DoubleVar()
        tkvar.set(inival)
        # Set a callback for whenever tkvar is changed.
        # (The 'command' callback on the SpinBox only applies to the buttons.)
        tkvar.trace('w', self._update_callback)
        # Create the Label, SpinBox, and Scale objects.
        label = tk.Label(parent, text=label)
        spbox = tk.Spinbox(parent,
            textvariable=tkvar,
            from_=0, to=maxval, increment=res)
        slide = tk.Scale(parent,
            orient=tk.HORIZONTAL,
            showvalue=0,
            variable=tkvar,
            from_=0, to=maxval, resolution=res)
        label.grid(row=rowidx, column=0)
        spbox.grid(row=rowidx, column=1)
        slide.grid(row=rowidx, column=2)
        return tkvar

    # Find the largest output size that fits within the given bounds and
    # matches the aspect ratio of the original source image. 
開發者ID:ooterness,項目名稱:DualFisheye,代碼行數:26,代碼來源:fisheye.py

示例2: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def __init__(self, parent, env, canvas):
        super(EnvToolbar, self).__init__(parent, relief='raised', bd=2)

        # Initialize instance variables

        self.env = env
        self.canvas = canvas
        self.running = False
        self.speed = 1.0

        # Create buttons and other controls

        for txt, cmd in [('Step >', self.env.step),
                         ('Run >>', self.run),
                         ('Stop [ ]', self.stop),
                         ('List things', self.list_things),
                         ('List agents', self.list_agents)]:
            tk.Button(self, text=txt, command=cmd).pack(side='left')

        tk.Label(self, text='Speed').pack(side='left')
        scale = tk.Scale(self, orient='h',
                         from_=(1.0), to=10.0, resolution=1.0,
                         command=self.set_speed)
        scale.set(self.speed)
        scale.pack(side='left') 
開發者ID:hobson,項目名稱:aima,代碼行數:27,代碼來源:agents.py

示例3: __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

示例4: __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

示例5: plot

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def plot(self):
    if len(self.channels) < 1 or len(self.channels) > 2:
      print "The device can either operate as oscilloscope (1 channel) or x-y plotter (2 channels). Please operate accordingly."
      self._quit()
    else:
      print "Plotting will start in a new window..."
      try:
        # Setup Quit button
        button = Tkinter.Button(master=self.root, text='Quit', command=self._quit)
        button.pack(side=Tkinter.BOTTOM)
        # Setup speed and width
        self.scale1 = Tkinter.Scale(master=self.root,label="View Width:", from_=3, to=1000, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL)
        self.scale2 = Tkinter.Scale(master=self.root,label="Generation Speed:", from_=1, to=200, sliderlength=30, length=self.ax.get_window_extent().width, orient=Tkinter.HORIZONTAL)
        self.scale2.pack(side=Tkinter.BOTTOM)
        self.scale1.pack(side=Tkinter.BOTTOM)
        self.scale1.set(4000)
        self.scale2.set(self.scale2['to']-10)
        self.root.protocol("WM_DELETE_WINDOW", self._quit)
        if len(self.channels) == 1:
          self.values = []
        else:
          self.valuesx = [0 for x in range(4000)]
          self.valuesy = [0 for y in range(4000)]
        self.root.after(4000, self.draw)
        Tkinter.mainloop()
      except Exception, err:
        print "Error. Try again."
        print err
        self._quit() 
開發者ID:ankitaggarwal011,項目名稱:PiScope,代碼行數:31,代碼來源:PiScope.py

示例6: __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:dxwu,項目名稱:BinderFilter,代碼行數:14,代碼來源:ttk.py

示例7: create

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def create(self, **kwargs):
        return tkinter.Scale(self.root, **kwargs) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:4,代碼來源:test_widgets.py

示例8: test_grid_size

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def test_grid_size(self):
        with self.assertRaises(TypeError):
            self.root.grid_size(0)
        self.assertEqual(self.root.grid_size(), (0, 0))
        f = tkinter.Scale(self.root)
        f.grid_configure(row=0, column=0)
        self.assertEqual(self.root.grid_size(), (1, 1))
        f.grid_configure(row=4, column=5)
        self.assertEqual(self.root.grid_size(), (6, 5)) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:11,代碼來源:test_geometry_managers.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__

# 需要導入模塊: 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

示例11: init_scales

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Scale [as 別名]
def init_scales(self, vol):
        """
        """
        self.slice1 = vol.shape[0]//2
        self.slice2 = vol.shape[1]//2
        self.slice3 = vol.shape[2]//2
        x_size, y_size, z_size = vol.shape

        self.Scale1 = tk.Scale(self.Frame10, from_=0.0, to=z_size)
        self.Scale1.place(relx=0.871, rely=0.025, relwidth=0.0, relheight=0.942
                , width=46, bordermode='ignore')
        self.Scale1.configure(activebackground="#f9f9f9")
        self.Scale1.configure(command=self.AxialScroll)
        self.Scale1.configure(length="368")
        self.Scale1.configure(troughcolor="#d9d9d9")


        self.Scale2 = tk.Scale(self.Frame11, from_=0.0, to=y_size)
        self.Scale2.place(relx=0.871, rely=0.025, relwidth=0.0, relheight=0.942
                , width=46, bordermode='ignore')
        self.Scale2.configure(activebackground="#f9f9f9")
        self.Scale2.configure(command=self.SagitalScroll)
        self.Scale2.configure(digits="50")
        self.Scale2.configure(length="368")
        self.Scale2.configure(troughcolor="#d9d9d9")


        self.Scale3 = tk.Scale(self.Frame12, from_=0.0, to=x_size)
        self.Scale3.place(relx=0.871, rely=0.025, relwidth=0.0, relheight=0.942
                , width=46, bordermode='ignore')
        self.Scale3.configure(activebackground="#f9f9f9")
        self.Scale3.configure(command=self.CorronalScroll)
        self.Scale3.configure(length="368")
        self.Scale3.configure(troughcolor="#d9d9d9")


        self.TProgressbar1 = ttk.Progressbar(self.Frame2)
        self.TProgressbar1.place(relx=0.007, rely=0.948, relwidth=0.981
                , relheight=0.0, height=19)
        self.TProgressbar1.configure(variable=self.progress_bar)

        self.overlay_flag = False


    # ================================================================= 
開發者ID:koriavinash1,項目名稱:DeepBrainSeg,代碼行數:47,代碼來源:DeepBrainSegUI.py


注:本文中的Tkinter.Scale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。