Display the file size in the systray. This is a simple function that will help:
def sizeof_fmt(num: int, suffix: str = "o") -> str: """ Human readable version of file size. Supports: - all currently known binary prefixes (https://en.wikipedia.org/wiki/Binary_prefix) - negative and positive numbers - numbers larger than 1,000 Yobibytes - arbitrary units Examples: >>> sizeof_fmt(168963795964) "157.4 Gio" >>> sizeof_fmt(168963795964, suffix="B") "157.4 GiB" Source: https://stackoverflow.com/a/1094933/1117028 """ val = float(num) for unit in ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"): if abs(val) < 1024.0: return f"{val:3.1f} {unit}{suffix}" val /= 1024.0 return f"{val:.1f} Yi{suffix}"