Ejemplo n.º 1
0
    def initUI(self):
        self.master.title("Scale")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)

        scale = Scale(self, from_=0, to=100, command=self.on_scale)
        scale.pack(side=LEFT, padx=15)

        self.var = IntVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.pack(side=LEFT)
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        default_range = kwargs.pop("default_range", (60, 90))

        super().__init__(*args, **kwargs)

        color_list = ["green", "yellow"]
        label_list = []
        scale_list = []

        range_list = [*default_range]

        def on_scale0(value):
            value = int(float(value))
            if value > range_list[1]:
                scale_list[1].set(value)
                label_list[1]["text"] = f"{value: 3d}%"
            range_list[0] = value
            label_list[0]["text"] = f"{value: 3d}%"

        def on_scale1(value):
            value = int(float(value))
            if value < range_list[0]:
                scale_list[0].set(value)
                label_list[0]["text"] = f"{value: 3d}%"
            range_list[1] = value
            label_list[1]["text"] = f"{value: 3d}%"

        callback_list = [on_scale0, on_scale1]

        for index in range(2):
            frame = Frame(self)
            frame.pack(expand="yes", fill="x")
            label = Label(frame,
                          bg=color_list[index],
                          text=f"{default_range[index]: 3d}%",
                          width=5)
            label.pack(side="left")
            label_list.append(label)
            scale = Scale(frame,
                          from_=0,
                          to=100,
                          value=default_range[index],
                          orient="horizontal",
                          command=callback_list[index])
            scale.pack(side="left", fill="x", expand="yes")
            scale_list.append(scale)

        self.__scale_list = scale_list
Ejemplo n.º 3
0
    def initUI(self):
        self.parent.title("PRIMEP")
        self.pack(fill=BOTH, expand=True)
        global value
        value = 0
        global var
        var = IntVar()
        global num
        num = StringVar()
        global res
        res = StringVar()

        frame1 = Frame(self, style='My.TFrame')
        frame1.pack(fill=X)

        lbl1 = Label(frame1,
                     text="Enter a number :",
                     width=16,
                     background='orange')
        lbl1.pack(side=LEFT, padx=5, pady=5)

        entry1 = Entry(frame1, textvariable=num, style='My.TEntry')
        entry1.pack(fill=X, padx=5, expand=True)

        frame2 = Frame(self, style='My.TFrame')
        frame2.pack(fill=X)

        lbl2 = Label(frame2,
                     text="Set certainty :",
                     width=16,
                     background='orange')
        lbl2.pack(side=LEFT, padx=5, pady=5)

        #entry2 = Entry(frame2,textvariable=cer,style='My.TEntry')
        #entry2.pack(fill=X, padx=5, expand=True)

        scale = Scale(frame2,
                      from_=1,
                      to=25,
                      orient=HORIZONTAL,
                      command=self.onScale)
        scale.pack(side=LEFT, padx=5)

        #var = IntVar()
        label = Label(frame2, text=1, textvariable=var)
        label.pack(side=LEFT, padx=5)

        frame3 = Frame(self, style='My.TFrame')
        frame3.pack(fill=X)

        result = Label(frame3, textvariable=res, width=28, background='orange')
        result.pack(side=LEFT, padx=60, pady=5)

        frame4 = Frame(self, style='My.TFrame')
        frame4.pack(fill=X)

        btntest = Button(frame4,
                         text="Test",
                         width=10,
                         command=self.test,
                         style='My.TButton')
        btntest.pack(side=LEFT, anchor=N, padx=5, pady=5)

        btnclear = Button(frame4,
                          text="Clear",
                          width=10,
                          command=self.clear,
                          style='My.TButton')
        btnclear.pack(side=LEFT, anchor=N, padx=5, pady=5)

        btnclose = Button(frame4,
                          text="Close",
                          width=10,
                          command=self.quit,
                          style='My.TButton')
        btnclose.pack(side=LEFT, anchor=N, padx=5, pady=5)
Ejemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        pil_image = kwargs.pop('pil_image')
        balloon = None
        if 'balloon' in kwargs:
            balloon = kwargs.pop('balloon')
        photo = ImageTk.PhotoImage(pil_image)
        self.__photo = photo
        self.__origin_image = pil_image
        self.__zoomed_image = pil_image
        super().__init__(*args, **kwargs)
        
        self.__icons = icons = {}
        image_dir = Path(__file__).parent / 'images'

        for name in ('save', 'savezoom', 'copy'):
            icon_path = image_dir / (name+'.png')
            icon = ImageTk.PhotoImage(file=str(icon_path))
            icons[name] = icon

        frame = Frame(self)
        frame.pack(fill='x')
        
        save_dlg = lambda: asksaveasfilename(filetypes=[
                ('JPEG', '.jpg'), ('PNG', '.png')], 
            defaultextension='.jpg')        
                        
        def on_save(image):
            filename = save_dlg()
            if filename:
                image.save(filename)
        
        Label(frame, text=f'id={id(self)}').pack(side='left')
        save_btn = Button(frame, 
               image=icons['save'], 
               command=lambda:on_save(self.__origin_image))
        save_btn.pack(side='left')
        if balloon:
            balloon.bind_widget(save_btn, balloonmsg='Save image.')
        
        savezoom_btn = Button(frame, 
               image=icons['savezoom'], 
               command=lambda:on_save(self.__zoomed_image))
        savezoom_btn.pack(side='left')
        if balloon:
            balloon.bind_widget(savezoom_btn, balloonmsg='Save zoomed image.')
        
        if platform.system().lower() == 'windows':
            from wavesynlib.interfaces.os.windows.clipboard import clipb
            
            def on_copy():
                clipb.image_to_clipboard(self.__origin_image)
            copy_btn = Button(frame, image=icons['copy'], command=on_copy)
            copy_btn.pack(side='left')
            if balloon:
                balloon.bind_widget(copy_btn, balloonmsg='Copy image.')

        scale = Scale(frame, from_=0, to=100, orient='horizontal', value=100)
        scale.pack(side='left')
        zoomed_label = Label(frame, text='100%')
        zoomed_label.pack(side='left')
        
        self.__label = label = Label(self, image=photo)
        label.pack(expand='yes', fill='both')
        
        def on_scale(val):
            val = float(val)
            width, height = self.__origin_image.size
            width = int(width * val / 100)
            height = int(height * val / 100)
            if width<=0 or height<=0:
                return
            zoomed_image = self.__origin_image.resize((width, height), 
                                                      Image.ANTIALIAS)
            self.__zoomed_image = zoomed_image
            self.__photo = ImageTk.PhotoImage(zoomed_image)
            self.__label['image'] = self.__photo
            zoomed_label['text'] = f'{int(val)}%'
            
        scale['command'] = on_scale
Ejemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        timer = TkTimer(widget=self, interval=0.2*pq.second, active=False)
        
        self.__battery_images = battery_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('battery'))
        for image_name in ['10per', '25per', '50per', '75per', '100per',
                           '10per_charge', '25per_charge', 
                           '50per_charge', '75per_charge', '100per_charge']:
            battery_images[image_name] = ImageTk.PhotoImage(
                file=str(image_dir/(image_name+'.png')))
            
        balloon = Scripting.root_node.gui.balloon
                        
        self.__busy_lamp = busy_lamp = BusyLight(self)
        busy_lamp.pack(side='right', fill='y')
        
        balloon.bind_widget(busy_lamp, balloonmsg='''Main-thread status.
Green: main-thread is available;
Red:   main-thread is busy.''')
        
        battery_meter = Label(self)
        battery_meter.pack(side='right', fill='y')
        battery_meter_tip = balloon.bind_widget(battery_meter, balloonmsg='Battery: ')
        def battery_meter_tip_show_callback():
            battery_status = Scripting.root_node.interfaces.os.get_battery_status()
            if battery_status is None:
                return 'No battery detected.'
            else:
                return f'{battery_status.percent}%'
        battery_meter_tip.show_callback = battery_meter_tip_show_callback
        
        self.__membar = IntVar(0)
        self.__cpubar = IntVar(0)
        self._make_cpu_mem_status()

        # Transparent Scale {
        def on_scale(val):
            Scripting.root_node.gui.console.set_opacity(val)
        trans_scale = Scale(self, from_=0.2, to=1.0, orient='horizontal', value=1, command=on_scale)
        trans_scale.pack(side='right')
        balloon.bind_widget(trans_scale, balloonmsg='Set the opacity of the console.')
        # } End Transparent Scale

        # Topmost Button {
        import tkinter
        topmost_button = tkinter.Button(self, text='TOP', relief='groove') 
        topmost_button.pack(side='right')
        
        def on_click():
            console =Scripting.root_node.gui.console
            b = console.is_topmost
            fg = 'black' if b else 'lime green'
            topmost_button['fg'] = fg
            with code_printer(True):
                console.set_topmost(not b)
            
        topmost_button['command'] = on_click
        balloon.bind_widget(topmost_button, balloonmsg='Set the console as a topmost window.')
        # } End Topmost Button 
        
        # Doc Button {
        docbtn = tkinter.Button(self, text='DOC', relief='groove')
        docbtn.pack(side='right')
        
        def on_click():
            docwin = Scripting.root_node.gui.console.doc_window
            with code_printer(True):
                docwin.show_window()
                
        docbtn['command'] = on_click
        balloon.bind_widget(docbtn, balloonmsg='Show document window.')
        #} End Doc Window        
        
        # Debug Button {
        debbtn = tkinter.Button(self, text='DEB', relief='groove')
        debbtn.pack(side='right')
        
        def on_click():
            debwin = Scripting.root_node.gui.console.debug_window
            with code_printer(True):
                debwin.show_window()
                
        debbtn['command'] = on_click
        balloon.bind_widget(debbtn, balloonmsg='Show debug window.')
        #} End Debug Button
        
        #{ Window Combo
        window_combo = Combobox(self, value=[], takefocus=1, stat='readonly')
        def on_selected(event):
            text = event.widget.get()
            wid = int(text.split(':')[1].strip())
            Scripting.root_node.gui.windows[wid].tk_object.deiconify()
        window_combo.bind('<<ComboboxSelected>>', on_selected)
        window_combo.pack(side='right', fill='y') # deiconify a window
        
        @Scripting.root_node.gui.windows.add_observer
        def on_windows_change(node, command):
            values = window_combo['values']
            if values == '':
                values = []
            if isinstance(values, tuple):
                values = list(values)
            node_id = id(node)
            if command == 'new':
                type_name = node.__class__.__name__
                values.append(f'{type_name}: {node_id}')
            elif command == 'del':
                for index, value in enumerate(values):
                    wid = int(value.split(':')[1].strip())
                    if node_id == wid:
                        del values[index]
            window_combo['values'] = values
            if len(values) > 0:
                window_combo.current(len(values)-1)
            else:
                window_combo.set('')
        #} End Window Combo
                        
        self.__lock = thread.allocate_lock()
        self.__busy = False
             
        os_node = Scripting.root_node.interfaces.os
        get_memory_usage = os_node.get_memory_usage
        get_cpu_usage    = os_node.get_cpu_usage
        get_battery_status = os_node.get_battery_status
                                
        def check_cpu_mem_battery(event):
            with code_printer(print_=False):
                self.__membar.set(get_memory_usage())
                self.__cpubar.set(get_cpu_usage())
                battery_status = get_battery_status()
                if battery_status:
                    percent = battery_status.percent
                    if percent > 75:
                        percent = 100
                    elif percent > 50:
                        percent = 75
                    elif percent > 25:
                        percent = 50
                    elif percent > 10:
                        percent = 25
                    else:
                        percent = 10
                    
                    charge = '_charge' if battery_status.power_plugged else ''
                    image_name = f'{percent}per{charge}'
                    image = battery_images[image_name]
                    if battery_meter['image'] != image:
                        battery_meter['image'] = image
                
        timer.divider(divide_by=10).add_observer(check_cpu_mem_battery)                
        timer.active = True
Ejemplo n.º 6
0
    def start(self):
        """Called when initialised to create test widgets."""

        self.img = ScalingImage(file=self.imgpath)

        self.my_label = Label(Toplevel(self), image=self.img)
        self.my_label.__image = self.img
        # The window snaps to the right size faster with these pack options
        self.my_label.pack(fill="both",
                           expand="true",
                           side="left",
                           anchor="nw")

        self.numer_var = IntVar()
        self.denom_var = IntVar()
        self.numer_display_var = IntVar()
        self.denom_display_var = IntVar()

        self.numer_var.set(10)
        self.denom_var.set(20)
        self.numer_display_var.set(10)
        self.denom_display_var.set(20)

        frac_frame = LabelFrame(self, text="Full Fraction")
        frac_frame.pack(side="left",
                        fill="both",
                        expand="true",
                        padx=5,
                        pady=5)

        frac_numer_scale = Scale(frac_frame,
                                 variable=self.numer_var,
                                 from_=1,
                                 to=100,
                                 orient="vertical",
                                 command=lambda i: self.on_frac_changed())
        frac_numer_scale.bind("<ButtonRelease>", lambda e: self.on_end_zoom())
        frac_numer_scale.pack(side="left")

        frac_denom_scale = Scale(frac_frame,
                                 variable=self.denom_var,
                                 from_=1,
                                 to=100,
                                 orient="vertical",
                                 command=lambda i: self.on_frac_changed())
        frac_denom_scale.bind("<ButtonRelease>", lambda e: self.on_end_zoom())
        frac_denom_scale.pack(side="left")

        Label(frac_frame, textvariable=self.numer_display_var).pack()
        Label(frac_frame, text="__\n").pack()
        Label(frac_frame, textvariable=self.denom_display_var).pack()

        numer_scale_frame = LabelFrame(self, text="Numeric Scale")
        numer_scale_frame.pack(side="left",
                               fill="both",
                               expand="true",
                               padx=5,
                               pady=5)

        self.numer_scale_var = IntVar()
        self.numer_scale_display_var = IntVar()
        self.numer_scale_var.set(20)
        self.numer_scale_display_var.set(20)

        zoom_scale = Scale(numer_scale_frame,
                           from_=1,
                           to=60,
                           variable=self.numer_scale_var,
                           orient="horizontal",
                           command=lambda i: self.on_numer_scale_changed())
        zoom_scale.bind("<ButtonRelease>", lambda e: self.on_end_zoom())
        zoom_scale.pack(fill="x")

        Label(numer_scale_frame,
              textvariable=self.numer_scale_display_var).pack()
        Label(numer_scale_frame, text="__\n\n20").pack()

        decimal_frame = LabelFrame(self, text="Decimal")
        decimal_frame.pack(side="left",
                           fill="both",
                           expand="true",
                           padx=5,
                           pady=5)

        self.decimal_scale_var = DoubleVar()
        self.decimal_display_var = DoubleVar()
        self.decimal_scale_var.set(1)
        self.decimal_display_var.set(1)

        decimal_scale = Scale(decimal_frame,
                              variable=self.decimal_scale_var,
                              from_=0.01,
                              to=3,
                              command=lambda i: self.on_decimal_changed())
        decimal_scale.bind("<ButtonRelease>", lambda e: self.on_end_zoom())
        decimal_scale.pack()

        Label(decimal_frame, textvariable=self.decimal_display_var).pack()

        Button(self, text="Reset", command=self.on_reset).pack(side="left")
Ejemplo n.º 7
0
class Slider(Frame):
    MINIMO = 100
    MAXIMO = 2400
    
    def __init__(self, master, label, *args, **kwargs):
        '''
        parametros
        ----------
        master : tkinter.widget
        
        label : str
        
        '''
        super(Slider, self).__init__(master, *args, **kwargs)
        self._criar_estilo_label()
       
        self._criar_scale()
        self._criar_spinbox()
        self._criar_label(label)
        self.set_atual(self.MINIMO)

    def _criar_estilo_label(self):
        estilo = Style()
        estilo.configure('Slider.TLabel', font=('Arial', 14, 'normal'))
          
    def _criar_label(self, label):
        '''
        Criar label.
        '''
        frame = Frame(self, width=150, height=50)
        label = Label(frame, text=label, anchor='center', style='Slider.TLabel')
        
        label.bind('<Double-Button-1>', lambda e: self._spinbox.focus())

        label.pack(fill='both', expand=True, padx=5, pady=5)
        frame.pack(side='left')
        frame.pack_propagate(False)
                                       
    def _criar_spinbox(self):
        '''
        Criar Widget spinbox.
        '''
        self._spinbox = Spinbox(self, from_=self.MINIMO, 
                                         to=self.MAXIMO,
                            font=('Arial', 14, 'normal'),
                            width=10)
        
        self._spinbox['command'] = lambda: \
            self.set_atual(self._spinbox.get(), widget=self._spinbox)
        
        self._spinbox.bind('<Return>', lambda e: \
            self.set_atual(self._spinbox.get()))
        
        self._spinbox.pack(side='left', anchor='center')
    
    def _criar_scale(self):
        '''
        Criar widget Scale.
        '''
        self._scale = Scale(self, from_=self.MINIMO, 
                                    to=self.MAXIMO, 
                                orient='horizontal')
        
        self._scale['command'] = lambda e: \
            self.set_atual(self._scale.get(), widget=self._scale)  
                                        
        self._scale.pack(side='left', fill='x', anchor='center', expand=True, )
        
    def atual(self):
        '''
        Obter o valor atual
        
        retornos
        --------
        int
        '''
        return self._scale.get()
        
    def set_atual(self, atual, **kwargs):
        '''
        Define o valor atual.
        
        parametros
        ----------
        atual : int
        '''
        # caractere númerico é convertido em inteiro.
        if isinstance(atual, str) and atual.isdigit():
            atual = int(atual)
        
        # caractere não númerico convertido em inteiro.
        if not isinstance(atual, int):
            atual = self._scale.get()
        
        # atual fora do range.
        if atual not in range(self.MINIMO, self.MAXIMO):
            atual = self._scale.get()        
        
        widget = kwargs.get('widget')
        if widget:
            if isinstance(widget, Scale):
                self._spinbox.delete(0, 'end')
                self._spinbox.insert(0, str(atual))
            elif isinstance(widget, Spinbox):
                self._scale.set(atual)
        
        else:
            self._spinbox.delete(0, 'end')
            self._spinbox.insert(0, str(atual))
            self._scale.set(atual)
Ejemplo n.º 8
0
    @state.setter
    def state(self, state):
        self.__tbm.SetProgressState(GetParent(self.__root.winfo_id()), state)


if __name__ == '__main__':
    from tkinter import Tk
    from tkinter.ttk import Scale, Combobox

    root = Tk()
    icon = TaskbarIcon(root)

    def on_combo_change(event):
        text = event.widget.get()
        icon.state = getattr(TBPFLAG, f"TBPF_{text}")

    combo = Combobox(root,
                     value=["NORMAL", "PAUSED", "ERROR"],
                     stat="readonly")
    combo.bind("<<ComboboxSelected>>", on_combo_change)
    combo.current(0)
    combo.pack()

    def on_scale(value):
        value = int(float(value))
        icon.progress = value

    scale = Scale(root, from_=0, to=100, value=0, command=on_scale)
    scale.pack(fill="x")

    root.mainloop()
Ejemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        timer = TkTimer(widget=self, interval=200, active=False)
        
        self.__battery_images = battery_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('battery'))
        for image_name in ['10per', '25per', '50per', '75per', '100per',
                           '10per_charge', '25per_charge', 
                           '50per_charge', '75per_charge', '100per_charge']:
            battery_images[image_name] = ImageTk.PhotoImage(
                file=str(image_dir/(image_name+'.png')))
            
        self.__busy_images = busy_images = {}
        image_dir = Path(Scripting.root_node.get_gui_image_path('busysignal'))
        busy_images['busy'] = ImageTk.PhotoImage(file=str(image_dir/('busy'+'.png')))
        busy_images['available'] = ImageTk.PhotoImage(file=str(image_dir/('available'+'.png')))

        balloon = Scripting.root_node.gui.balloon
                        
        self.__busy_lamp = busy_lamp = Label(self)
        busy_lamp['image'] = busy_images['available']
        busy_lamp.pack(side='right', fill='y')
        
        balloon.bind_widget(busy_lamp, balloonmsg='''Main-thread status.
Green: main-thread is available;
Red:   main-thread is busy.''')
        
        battery_meter = Label(self)
        battery_meter.pack(side='right', fill='y')
        battery_meter_tip = balloon.bind_widget(battery_meter, balloonmsg='Battery: ')
        def battery_meter_tip_show_callback():
            battery_status = Scripting.root_node.interfaces.os.get_battery_status()
            if battery_status is None:
                return 'No battery detected.'
            else:
                return f'{battery_status.percent}%'
        battery_meter_tip.show_callback = battery_meter_tip_show_callback
        
        self.__membar = IntVar(0)
        self.__cpubar = IntVar(0)
        self._make_cpu_mem_status()

        # Transparent Scale {
        def on_scale(val):
            Scripting.root_node.gui.console.set_opacity(val)
        trans_scale = Scale(self, from_=0.2, to=1.0, orient='horizontal', value=1, command=on_scale)
        trans_scale.pack(side='right')
        balloon.bind_widget(trans_scale, balloonmsg='Set the opacity of the console.')
        # } End Transparent Scale

        # Topmost Button {
        import tkinter
        topmost_button = tkinter.Button(self, text='TOP', relief='groove') 
        topmost_button.pack(side='right')
        
        def on_click():
            console =Scripting.root_node.gui.console
            b = console.is_topmost
            fg = 'black' if b else 'lime green'
            topmost_button['fg'] = fg
            with code_printer(True):
                console.set_topmost(not b)
            
        topmost_button['command'] = on_click
        balloon.bind_widget(topmost_button, balloonmsg='Set the console as a topmost window.')
        # } End Topmost Button 
        
        # Doc Button {
        docbtn = tkinter.Button(self, text='DOC', relief='groove')
        docbtn.pack(side='right')
        
        def on_click():
            docwin = Scripting.root_node.gui.console.doc_window
            with code_printer(True):
                docwin.show_window()
                
        docbtn['command'] = on_click
        balloon.bind_widget(docbtn, balloonmsg='Show document window.')
        #} End Doc Window        
        
        # Debug Button {
        debbtn = tkinter.Button(self, text='DEB', relief='groove')
        debbtn.pack(side='right')
        
        def on_click():
            debwin = Scripting.root_node.gui.console.debug_window
            with code_printer(True):
                debwin.show_window()
                
        debbtn['command'] = on_click
        balloon.bind_widget(debbtn, balloonmsg='Show debug window.')
        #} End Debug Button
        
        #{ Window Combo
        window_combo = Combobox(self, value=[], takefocus=1, stat='readonly')
        def on_selected(event):
            text = event.widget.get()
            wid = int(text.split(':')[1].strip())
            Scripting.root_node.gui.windows[wid].tk_object.deiconify()
        window_combo.bind('<<ComboboxSelected>>', on_selected)
        window_combo.pack(side='right', fill='y') # deiconify a window
        
        @Scripting.root_node.gui.windows.add_observer
        def on_windows_change(node, command):
            values = window_combo['values']
            if values == '':
                values = []
            if isinstance(values, tuple):
                values = list(values)
            node_id = id(node)
            if command == 'new':
                type_name = node.__class__.__name__
                values.append(f'{type_name}: {node_id}')
            elif command == 'del':
                for index, value in enumerate(values):
                    wid = int(value.split(':')[1].strip())
                    if node_id == wid:
                        del values[index]
            window_combo['values'] = values
            if len(values) > 0:
                window_combo.current(len(values)-1)
            else:
                window_combo.set('')
        #} End Window Combo
                        
        self.__lock = thread.allocate_lock()
        self.__busy = False
             
        os_node = Scripting.root_node.interfaces.os
        get_memory_usage = os_node.get_memory_usage
        get_cpu_usage    = os_node.get_cpu_usage
        get_battery_status = os_node.get_battery_status
                                
        def check_cpu_mem_battery():
            with code_printer(print_=False):
                self.__membar.set(get_memory_usage())
                self.__cpubar.set(get_cpu_usage())
                battery_status = get_battery_status()
                if battery_status:
                    percent = battery_status.percent
                    if percent > 75:
                        percent = 100
                    elif percent > 50:
                        percent = 75
                    elif percent > 25:
                        percent = 50
                    elif percent > 10:
                        percent = 25
                    else:
                        percent = 10
                    
                    charge = '_charge' if battery_status.power_plugged else ''
                    image_name = f'{percent}per{charge}'
                    image = battery_images[image_name]
                    if battery_meter['image'] != image:
                        battery_meter['image'] = image
                
        timer.divider(divide_by=10).add_observer(check_cpu_mem_battery)                
        timer.active = True
                          bd=0,
                          bg="black",
                          font="ubuntu 20",
                          fg="skyblue")
volume_frame.grid(row=0, column=5, padx=1)

# Creating the volume slider
volmune_slider = Scale(volume_frame,
                       style="TScale",
                       from_=0,
                       to=1,
                       value=1,
                       orient=HORIZONTAL,
                       length=150,
                       command=volume)
volmune_slider.pack(side=RIGHT)

# ====================================================================================

# ============================================================================

#              BUTTONS:: PLAY,PAUSE,STOP,NEXT,PREVIOUS

# ===============================================================================

backward_button = Button(f1,
                         padx=10,
                         border=0,
                         image=backward,
                         highlightthickness=0,
                         command=previous)