Python ttk.Scale() Examples

The following are 7 code examples of ttk.Scale(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module ttk , or try the search function .
Example #1
Source File: gui.py    From stochopy with MIT License 8 votes vote down vote up
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 
Example #2
Source File: widget_tests.py    From oss-ftp with MIT License 6 votes vote down vote up
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) 
Example #3
Source File: test_widgets.py    From BinderFilter with MIT License 5 votes vote down vote up
def setUp(self):
        support.root_deiconify()
        self.scale = ttk.Scale()
        self.scale.pack()
        self.scale.update() 
Example #4
Source File: test_widgets.py    From oss-ftp with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs) 
Example #5
Source File: Controls.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
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 
Example #6
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Scale(self.root, **kwargs) 
Example #7
Source File: main-gui.py    From Tkinter-Projects with MIT License 4 votes vote down vote up
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)