sysmon_pytk.widgets.meters
Various Meter widgets.
1# SPDX-FileCopyrightText: © 2024 Stacey Adams <stacey.belle.rose@gmail.com> 2# SPDX-License-Identifier: MIT 3 4""" 5Various Meter widgets. 6""" 7 8from .cpu_meter import CpuMeter 9from .disk_meter import DiskMeter 10from .ram_meter import RamMeter 11from .temp_meter import TempMeter 12from .updating_meter import UpdatingMeter 13 14__all__ = ["UpdatingMeter", "CpuMeter", "DiskMeter", "RamMeter", "TempMeter"]
28class UpdatingMeter(Meter): 29 """ 30 A Meter that can update itself. 31 """ 32 33 def __init__( 34 self, parent: Misc, *, width: int = 300, height: int = 225, **kw 35 ) -> None: 36 """ 37 Construct a self-updating meter. 38 39 Parameters 40 ---------- 41 parent : Misc 42 The parent widget. 43 width : int 44 The width of the meter widget. 45 height : int 46 The height of the meter widget. 47 **kw : dict, optional 48 Arguments to pass to parent Meter class. 49 """ 50 super().__init__( 51 parent, width=width, height=height, **kw 52 ) 53 self._update_job: str | None = None 54 self.bind("<<ThemeChanged>>", self._update_theme) 55 self.bind("<Destroy>", self.on_destroy) 56 if self.is_clickable(): 57 self.bind("<Button-1>", self.on_click) 58 self.configure(cursor="hand2") 59 self.update_widget() 60 61 def _update_theme(self, *_args) -> None: 62 super().update_for_dark_mode() 63 64 def is_clickable(self) -> bool: 65 """ 66 Determine if this Meter is clickable. 67 """ 68 return True 69 70 def get_app_title(self) -> str: 71 """ 72 Get the window title, based on a widget. 73 """ 74 return self.winfo_toplevel().title() 75 76 def on_destroy(self, *_args) -> None: 77 """ 78 Cancel the update job when widget is destroyed. 79 """ 80 if self._update_job is not None: 81 self.after_cancel(self._update_job) 82 self._update_job = None 83 84 @abstractmethod 85 def on_click(self, *args) -> None: 86 """ 87 Handle a click event. 88 """ 89 90 @abstractmethod 91 def get_value(self) -> float: 92 """ 93 Get the value that should update the meter. 94 """ 95 96 @final 97 def add_tooltip(self, text: str) -> None: 98 """ 99 Add a ToolTip to the Meter. 100 101 This method should be called by subclasses which wish to display 102 a ToolTip when the mouse is hovering over the widget. It should be 103 called at the end of `__init__`. 104 """ 105 if self.is_clickable(): 106 ToolTip(self, text) 107 108 @final 109 def update_widget(self) -> None: 110 """ 111 Update the Meter. 112 """ 113 self.set_value(self.get_value()) 114 self._update_job = self.after(REFRESH_INTERVAL, self.update_widget)
A Meter that can update itself.
33 def __init__( 34 self, parent: Misc, *, width: int = 300, height: int = 225, **kw 35 ) -> None: 36 """ 37 Construct a self-updating meter. 38 39 Parameters 40 ---------- 41 parent : Misc 42 The parent widget. 43 width : int 44 The width of the meter widget. 45 height : int 46 The height of the meter widget. 47 **kw : dict, optional 48 Arguments to pass to parent Meter class. 49 """ 50 super().__init__( 51 parent, width=width, height=height, **kw 52 ) 53 self._update_job: str | None = None 54 self.bind("<<ThemeChanged>>", self._update_theme) 55 self.bind("<Destroy>", self.on_destroy) 56 if self.is_clickable(): 57 self.bind("<Button-1>", self.on_click) 58 self.configure(cursor="hand2") 59 self.update_widget()
Construct a self-updating meter.
Parameters
- parent (Misc): The parent widget.
- width (int): The width of the meter widget.
- height (int): The height of the meter widget.
- **kw (dict, optional): Arguments to pass to parent Meter class.
64 def is_clickable(self) -> bool: 65 """ 66 Determine if this Meter is clickable. 67 """ 68 return True
Determine if this Meter is clickable.
70 def get_app_title(self) -> str: 71 """ 72 Get the window title, based on a widget. 73 """ 74 return self.winfo_toplevel().title()
Get the window title, based on a widget.
76 def on_destroy(self, *_args) -> None: 77 """ 78 Cancel the update job when widget is destroyed. 79 """ 80 if self._update_job is not None: 81 self.after_cancel(self._update_job) 82 self._update_job = None
Cancel the update job when widget is destroyed.
90 @abstractmethod 91 def get_value(self) -> float: 92 """ 93 Get the value that should update the meter. 94 """
Get the value that should update the meter.
96 @final 97 def add_tooltip(self, text: str) -> None: 98 """ 99 Add a ToolTip to the Meter. 100 101 This method should be called by subclasses which wish to display 102 a ToolTip when the mouse is hovering over the widget. It should be 103 called at the end of `__init__`. 104 """ 105 if self.is_clickable(): 106 ToolTip(self, text)
Add a ToolTip to the Meter.
This method should be called by subclasses which wish to display
a ToolTip when the mouse is hovering over the widget. It should be
called at the end of __init__.
108 @final 109 def update_widget(self) -> None: 110 """ 111 Update the Meter. 112 """ 113 self.set_value(self.get_value()) 114 self._update_job = self.after(REFRESH_INTERVAL, self.update_widget)
Update the Meter.
Inherited Members
- sysmon_pytk.widgets.meter.Meter
- check_dark_mode
- update_for_dark_mode
- set_value
- bind
- tkinter.BaseWidget
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location
29class CpuMeter(UpdatingMeter): 30 """ 31 A Meter to monitor CPU usage. 32 """ 33 34 def __init__( 35 self, parent: Misc, *, width: int = 300, height: int = 225 36 ) -> None: 37 """ 38 Construct a self-updating meter to monitor CPU usage. 39 40 Parameters 41 ---------- 42 parent : Misc 43 The parent widget. 44 width : int 45 The width of the widget. 46 height : int 47 The height of the widget. 48 """ 49 super().__init__( 50 parent, width=width, height=height, min_value=0, max_value=100, 51 label=_("CPU Usage"), unit="%", divisions=10, yellow=15, red=15, 52 blue=0 53 ) 54 self.add_tooltip(_("Click for per-CPU usage")) 55 56 def is_clickable(self) -> bool: 57 """ 58 CPU Meter is only clickable if more than one CPU/core is present. 59 """ 60 return psutil.cpu_count() > 1 61 62 def get_value(self) -> float: 63 """ 64 Get the value that should update the meter. 65 """ 66 return psutil.cpu_percent(interval=None) 67 68 def on_click(self, *_args) -> None: 69 """ 70 Open CPU Details. 71 """ 72 app_title = self.get_app_title() 73 modals.CpuDialog( 74 self, title=_("{} :: CPU Details").format(app_title), 75 iconpath=get_full_path("images/icon.png") 76 )
A Meter to monitor CPU usage.
34 def __init__( 35 self, parent: Misc, *, width: int = 300, height: int = 225 36 ) -> None: 37 """ 38 Construct a self-updating meter to monitor CPU usage. 39 40 Parameters 41 ---------- 42 parent : Misc 43 The parent widget. 44 width : int 45 The width of the widget. 46 height : int 47 The height of the widget. 48 """ 49 super().__init__( 50 parent, width=width, height=height, min_value=0, max_value=100, 51 label=_("CPU Usage"), unit="%", divisions=10, yellow=15, red=15, 52 blue=0 53 ) 54 self.add_tooltip(_("Click for per-CPU usage"))
Construct a self-updating meter to monitor CPU usage.
Parameters
- parent (Misc): The parent widget.
- width (int): The width of the widget.
- height (int): The height of the widget.
56 def is_clickable(self) -> bool: 57 """ 58 CPU Meter is only clickable if more than one CPU/core is present. 59 """ 60 return psutil.cpu_count() > 1
CPU Meter is only clickable if more than one CPU/core is present.
62 def get_value(self) -> float: 63 """ 64 Get the value that should update the meter. 65 """ 66 return psutil.cpu_percent(interval=None)
Get the value that should update the meter.
68 def on_click(self, *_args) -> None: 69 """ 70 Open CPU Details. 71 """ 72 app_title = self.get_app_title() 73 modals.CpuDialog( 74 self, title=_("{} :: CPU Details").format(app_title), 75 iconpath=get_full_path("images/icon.png") 76 )
Open CPU Details.
Inherited Members
- sysmon_pytk.widgets.meter.Meter
- check_dark_mode
- update_for_dark_mode
- set_value
- bind
- tkinter.BaseWidget
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location
30class DiskMeter(UpdatingMeter): 31 """ 32 A Meter to monitor disk usage. 33 """ 34 35 def __init__( 36 self, parent: Misc, *, width: int = 300, height: int = 225 37 ) -> None: 38 """ 39 Construct a self-updating meter to monitor disk usage. 40 41 Parameters 42 ---------- 43 parent : Misc 44 The parent widget. 45 width : int 46 The width of the widget. 47 height : int 48 The height of the widget. 49 """ 50 super().__init__( 51 parent, width=width, height=height, min_value=0, max_value=100, 52 label=_("Disk Usage: /"), unit="%", divisions=10, blue=0, 53 red=100 - DISK_ALERT_LEVEL, yellow=DISK_ALERT_LEVEL - DISK_WARN_LEVEL 54 ) 55 self.add_tooltip(_("Click for usage details of each mount point")) 56 57 def get_value(self) -> float: 58 """ 59 Get the value that should update the meter. 60 """ 61 return psutil.disk_usage("/").percent 62 63 def on_click(self, *_args) -> None: 64 """ 65 Open Disk Usage. 66 """ 67 app_title = self.get_app_title() 68 modals.DiskUsageDialog( 69 self, title=_("{} :: Disk Usage").format(app_title), 70 iconpath=get_full_path("images/icon.png") 71 )
A Meter to monitor disk usage.
35 def __init__( 36 self, parent: Misc, *, width: int = 300, height: int = 225 37 ) -> None: 38 """ 39 Construct a self-updating meter to monitor disk usage. 40 41 Parameters 42 ---------- 43 parent : Misc 44 The parent widget. 45 width : int 46 The width of the widget. 47 height : int 48 The height of the widget. 49 """ 50 super().__init__( 51 parent, width=width, height=height, min_value=0, max_value=100, 52 label=_("Disk Usage: /"), unit="%", divisions=10, blue=0, 53 red=100 - DISK_ALERT_LEVEL, yellow=DISK_ALERT_LEVEL - DISK_WARN_LEVEL 54 ) 55 self.add_tooltip(_("Click for usage details of each mount point"))
Construct a self-updating meter to monitor disk usage.
Parameters
- parent (Misc): The parent widget.
- width (int): The width of the widget.
- height (int): The height of the widget.
57 def get_value(self) -> float: 58 """ 59 Get the value that should update the meter. 60 """ 61 return psutil.disk_usage("/").percent
Get the value that should update the meter.
63 def on_click(self, *_args) -> None: 64 """ 65 Open Disk Usage. 66 """ 67 app_title = self.get_app_title() 68 modals.DiskUsageDialog( 69 self, title=_("{} :: Disk Usage").format(app_title), 70 iconpath=get_full_path("images/icon.png") 71 )
Open Disk Usage.
Inherited Members
- sysmon_pytk.widgets.meter.Meter
- check_dark_mode
- update_for_dark_mode
- set_value
- bind
- tkinter.BaseWidget
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location
29class RamMeter(UpdatingMeter): 30 """ 31 A Meter to monitor RAM usage. 32 """ 33 34 def __init__( 35 self, parent: Misc, *, width: int = 300, height: int = 225 36 ) -> None: 37 """ 38 Construct a self-updating meter to monitor RAM usage. 39 40 Parameters 41 ---------- 42 parent : Misc 43 The parent widget. 44 width : int 45 The width of the widget. 46 height : int 47 The height of the widget. 48 """ 49 super().__init__( 50 parent, width=width, height=height, min_value=0, max_value=100, 51 label=_("RAM Usage"), unit="%", divisions=10, yellow=15, red=15, 52 blue=0 53 ) 54 self.add_tooltip(_("Click for detailed memory statistics")) 55 56 def get_value(self) -> float: 57 """ 58 Get the value that should update the meter. 59 """ 60 return psutil.virtual_memory().percent 61 62 def on_click(self, *_args) -> None: 63 """ 64 Open Memory Usage. 65 """ 66 app_title = self.get_app_title() 67 modals.MemUsageDialog( 68 self, title=_("{} :: Memory Usage").format(app_title), 69 iconpath=get_full_path("images/icon.png") 70 )
A Meter to monitor RAM usage.
34 def __init__( 35 self, parent: Misc, *, width: int = 300, height: int = 225 36 ) -> None: 37 """ 38 Construct a self-updating meter to monitor RAM usage. 39 40 Parameters 41 ---------- 42 parent : Misc 43 The parent widget. 44 width : int 45 The width of the widget. 46 height : int 47 The height of the widget. 48 """ 49 super().__init__( 50 parent, width=width, height=height, min_value=0, max_value=100, 51 label=_("RAM Usage"), unit="%", divisions=10, yellow=15, red=15, 52 blue=0 53 ) 54 self.add_tooltip(_("Click for detailed memory statistics"))
Construct a self-updating meter to monitor RAM usage.
Parameters
- parent (Misc): The parent widget.
- width (int): The width of the widget.
- height (int): The height of the widget.
56 def get_value(self) -> float: 57 """ 58 Get the value that should update the meter. 59 """ 60 return psutil.virtual_memory().percent
Get the value that should update the meter.
62 def on_click(self, *_args) -> None: 63 """ 64 Open Memory Usage. 65 """ 66 app_title = self.get_app_title() 67 modals.MemUsageDialog( 68 self, title=_("{} :: Memory Usage").format(app_title), 69 iconpath=get_full_path("images/icon.png") 70 )
Open Memory Usage.
Inherited Members
- sysmon_pytk.widgets.meter.Meter
- check_dark_mode
- update_for_dark_mode
- set_value
- bind
- tkinter.BaseWidget
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location
28class TempMeter(UpdatingMeter): 29 """ 30 A Meter to monitor CPU temperature. 31 """ 32 33 def __init__( 34 self, parent: Misc, *, width: int = 300, height: int = 225 35 ) -> None: 36 """ 37 Construct a self-updating meter to monitor CPU temperature. 38 39 Parameters 40 ---------- 41 parent : Misc 42 The parent widget. 43 width : int 44 The width of the widget. 45 height : int 46 The height of the widget. 47 """ 48 super().__init__( 49 parent, width=width, height=height, min_value=0, max_value=100, 50 label=_("Temperature"), unit="°C", divisions=10, yellow=15, red=15, 51 blue=15 52 ) 53 self.add_tooltip(_("Click for detailed temperature readings")) 54 55 def get_value(self) -> float: 56 """ 57 Get the value that should update the meter. 58 """ 59 return cpu_temp() 60 61 def on_click(self, *_args) -> None: 62 """ 63 Open Temperature Details. 64 """ 65 app_title = self.get_app_title() 66 modals.TempDetailsDialog( 67 self, 68 title=_("{} :: Temperature Details").format(app_title), 69 iconpath=get_full_path("images/icon.png") 70 )
A Meter to monitor CPU temperature.
33 def __init__( 34 self, parent: Misc, *, width: int = 300, height: int = 225 35 ) -> None: 36 """ 37 Construct a self-updating meter to monitor CPU temperature. 38 39 Parameters 40 ---------- 41 parent : Misc 42 The parent widget. 43 width : int 44 The width of the widget. 45 height : int 46 The height of the widget. 47 """ 48 super().__init__( 49 parent, width=width, height=height, min_value=0, max_value=100, 50 label=_("Temperature"), unit="°C", divisions=10, yellow=15, red=15, 51 blue=15 52 ) 53 self.add_tooltip(_("Click for detailed temperature readings"))
Construct a self-updating meter to monitor CPU temperature.
Parameters
- parent (Misc): The parent widget.
- width (int): The width of the widget.
- height (int): The height of the widget.
55 def get_value(self) -> float: 56 """ 57 Get the value that should update the meter. 58 """ 59 return cpu_temp()
Get the value that should update the meter.
61 def on_click(self, *_args) -> None: 62 """ 63 Open Temperature Details. 64 """ 65 app_title = self.get_app_title() 66 modals.TempDetailsDialog( 67 self, 68 title=_("{} :: Temperature Details").format(app_title), 69 iconpath=get_full_path("images/icon.png") 70 )
Open Temperature Details.
Inherited Members
- sysmon_pytk.widgets.meter.Meter
- check_dark_mode
- update_for_dark_mode
- set_value
- bind
- tkinter.BaseWidget
- destroy
- tkinter.Misc
- deletecommand
- tk_strictMotif
- tk_bisque
- tk_setPalette
- wait_variable
- waitvar
- wait_window
- wait_visibility
- setvar
- getvar
- getboolean
- focus_set
- focus
- focus_force
- focus_get
- focus_displayof
- focus_lastfor
- tk_focusFollowsMouse
- tk_focusNext
- tk_focusPrev
- after
- after_idle
- after_cancel
- bell
- clipboard_get
- clipboard_clear
- clipboard_append
- grab_current
- grab_release
- grab_set
- grab_set_global
- grab_status
- option_add
- option_clear
- option_get
- option_readfile
- selection_clear
- selection_get
- selection_handle
- selection_own
- selection_own_get
- send
- lower
- tkraise
- lift
- winfo_atom
- winfo_atomname
- winfo_cells
- winfo_children
- winfo_class
- winfo_colormapfull
- winfo_containing
- winfo_depth
- winfo_exists
- winfo_fpixels
- winfo_geometry
- winfo_height
- winfo_id
- winfo_interps
- winfo_ismapped
- winfo_manager
- winfo_name
- winfo_parent
- winfo_pathname
- winfo_pixels
- winfo_pointerx
- winfo_pointerxy
- winfo_pointery
- winfo_reqheight
- winfo_reqwidth
- winfo_rgb
- winfo_rootx
- winfo_rooty
- winfo_screen
- winfo_screencells
- winfo_screendepth
- winfo_screenheight
- winfo_screenmmheight
- winfo_screenmmwidth
- winfo_screenvisual
- winfo_screenwidth
- winfo_server
- winfo_toplevel
- winfo_viewable
- winfo_visual
- winfo_visualid
- winfo_visualsavailable
- winfo_vrootheight
- winfo_vrootwidth
- winfo_vrootx
- winfo_vrooty
- winfo_width
- winfo_x
- winfo_y
- update
- update_idletasks
- unbind
- bind_all
- unbind_all
- bind_class
- unbind_class
- mainloop
- quit
- nametowidget
- register
- configure
- config
- cget
- keys
- pack_propagate
- propagate
- pack_slaves
- slaves
- place_slaves
- grid_anchor
- anchor
- grid_bbox
- bbox
- grid_columnconfigure
- columnconfigure
- grid_location
- grid_propagate
- grid_rowconfigure
- rowconfigure
- grid_size
- size
- grid_slaves
- event_add
- event_delete
- event_generate
- event_info
- image_names
- image_types
- tkinter.Pack
- pack_configure
- pack_forget
- forget
- pack_info
- info
- pack
- tkinter.Place
- place_configure
- place_forget
- place_info
- place
- tkinter.Grid
- grid_configure
- grid_forget
- grid_remove
- grid_info
- grid
- location