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


Python ttk.Scale方法代码示例

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


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

示例1: checkParam

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scale [as 别名]
def checkParam(self, widget, name, value, expected=_sentinel,
                   conv=False, eq=None):
        widget[name] = value
        if expected is _sentinel:
            expected = value
        if conv:
            expected = conv(expected)
        if self._stringify or not self.wantobjects:
            if isinstance(expected, tuple):
                expected = tkinter._join(expected)
            else:
                expected = str(expected)
        if eq is None:
            eq = tcl_obj_eq
        self.assertEqual2(widget[name], expected, eq=eq)
        self.assertEqual2(widget.cget(name), expected, eq=eq)
        # XXX
        if not isinstance(widget, Scale):
            t = widget.configure(name)
            self.assertEqual(len(t), 5)
            self.assertEqual2(t[4], expected, eq=eq) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:23,代码来源:widget_tests.py

示例2: _scale

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scale [as 别名]
def _scale(self, from_, to, resolution, variable, position, command = None,
               kwargs = {}):
        if command is None:
            command = lambda s: variable.set(round(float(s), 3))
        scale = ttk.Scale(self.frame1.sliders, from_ = from_, to = to, variable = variable,
                          orient = "horizontal", length = 20, command = command,
                          takefocus = False, **kwargs)
        if position == 1:
            scale.place(relwidth = 0.35, relx = 0, x = 0, y = 25, anchor = "nw")
        elif position == 2:
            scale.place(relwidth = 0.35, relx = 0, x = 0, y = 70, anchor = "nw")
        elif position == 3:
            scale.place(relwidth = 0.35, relx = 0.5, x = 0, y = 25, anchor = "nw")
        elif position == 4:
            scale.place(relwidth = 0.35, relx = 0.5, x = 0, y = 70, anchor = "nw")
        return scale 
开发者ID:keurfonluu,项目名称:stochopy,代码行数:18,代码来源:gui.py

示例3: setUp

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scale [as 别名]
def setUp(self):
        support.root_deiconify()
        self.scale = ttk.Scale()
        self.scale.pack()
        self.scale.update() 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:7,代码来源:test_widgets.py

示例4: create

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

示例5: create_control_panel

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scale [as 别名]
def create_control_panel(self):
        frame=Tkinter.LabelFrame(self.root)
        frame.pack(expand='yes',fill='x',side='top')
        add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif")
        add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif")
        exiticon=Tkinter.PhotoImage(file="../Icons/exit.gif")
        playicon=Tkinter.PhotoImage(file="../Icons/play.gif")
        pauseicon=Tkinter.PhotoImage(file="../Icons/pause.gif")
        stopicon=Tkinter.PhotoImage(file="../Icons/stop.gif")
        rewindicon=Tkinter.PhotoImage(file="../Icons/rewind.gif")
        fast_forwardicon=Tkinter.PhotoImage(file="../Icons/fast_forward.gif")
        previous_trackicon=Tkinter.PhotoImage(file="../Icons/previous_track.gif")
        next_trackicon=Tkinter.PhotoImage(file="../Icons/next_track.gif")
        self.muteicon=Tkinter.PhotoImage(file="../Icons/mute.gif")
        self.unmuteicon=Tkinter.PhotoImage(file="../Icons/unmute.gif")
        delete_selectedicon=Tkinter.PhotoImage(file="../Icons/delete_selected.gif")

        list_file=[
            (playicon,'self.play'),
            (pauseicon,'self.pause'),
            (stopicon,'self.stop'),
            (previous_trackicon,'self.previous'),
            (rewindicon,'self.rewind'),
            (fast_forwardicon,'self.fast'),
            (next_trackicon,'self.Next'),]
        for i,j in list_file:
            storeobj=ttk.Button(frame, image=i,command=eval(j))
            storeobj.pack(side='left')
            storeobj.image=i
        self.volume_label=Tkinter.Button(frame,image=self.unmuteicon)
        self.volume_label.image=self.unmuteicon
        
        volume=ttk.Scale(frame,from_=Volume_lowest_value, to=Volume_highest_value ,variable=self.var, command=self.update_volume)
        volume.pack(side='right', padx=10, )
        self.volume_label.pack(side='right')
        return 
开发者ID:surajsinghbisht054,项目名称:Python-Media-Player,代码行数:38,代码来源:Controls.py

示例6: create_button_frame

# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Scale [as 别名]
def create_button_frame(self):
		buttonframe = Frame(self.root)

		previcon = PhotoImage(file='icons/previous.gif')
		prevbtn = Button(buttonframe, image=previcon, borderwidth=0, padx=0, command=self.prev_track)
		prevbtn.image = previcon
		prevbtn.grid(row=0, column=0)
		self.balloon.bind(prevbtn, 'Previous Song')

		rewindicon = PhotoImage(file='icons/rewind.gif')
		rewindbtn = Button(buttonframe, image=rewindicon, borderwidth=0, padx=0, command=self.player.rewind)
		rewindbtn.image = rewindicon
		rewindbtn.grid(row=0, column=1)
		self.balloon.bind(rewindbtn, 'Go Back')

		self.playicon = PhotoImage(file='icons/play.gif')
		self.stopicon = PhotoImage(file='icons/stop.gif')
		self.playbtn = Button(buttonframe, text='play', image=self.playicon, borderwidth=0, padx=0, command=self.toggle_play_pause)
		self.playbtn.image = self.playicon
		self.playbtn.grid(row = 0, column=2)
		self.balloon.bind(self.playbtn, 'Play Song')

		fast_fwdicon = PhotoImage(file='icons/fast_fwd.gif')
		fast_fwdbtn = Button(buttonframe, image=fast_fwdicon, borderwidth=0, padx=0, command=self.player.fast_fwd)
		fast_fwdbtn.image = fast_fwdicon
		fast_fwdbtn.grid(row=0, column=3)
		self.balloon.bind(fast_fwdbtn, 'Fast Forward')

		nexticon = PhotoImage(file='icons/next.gif')
		nextbtn = Button(buttonframe, image=nexticon, borderwidth=0, padx=0, command=self.next_track)
		nextbtn.image = nexticon
		nextbtn.grid(row=0, column=4)
		self.balloon.bind(nextbtn, 'Next Song')

		self.muteicon = PhotoImage(file='icons/mute.gif')
		self.unmuteicon = PhotoImage(file='icons/unmute.gif')
		self.mutebtn = Button(buttonframe, text='unmute', image=self.unmuteicon, borderwidth=0, padx=0, command=self.toggle_mute)
		self.mutebtn.image = self.unmuteicon
		self.mutebtn.grid(row=0, column=5)
		self.balloon.bind(self.mutebtn, 'Mute/Unmute')

		self.volscale = ttk.Scale(buttonframe, from_=0.0, to=1.0, value=0.6, command=self.vol_update)
		self.volscale.grid(row=0, column=6, padx=5)

		buttonframe.grid(row=1, padx=4, pady=5, sticky=W) 
开发者ID:Leohc92,项目名称:Tkinter-Projects,代码行数:47,代码来源:main-gui.py


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