MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / _QuickMeter

Class _QuickMeter

PySimpleGUI/PySimpleGUI.py:18052–18178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18050
18051
18052class _QuickMeter(object):
18053 active_meters = {}
18054 exit_reasons = {}
18055
18056 def __init__(self, title, current_value, max_value, key, *args, orientation='v', bar_color=(None, None), button_color=(None, None),
18057 size=DEFAULT_PROGRESS_BAR_SIZE, border_width=None, grab_anywhere=False, no_titlebar=False, keep_on_top=None, no_button=False):
18058 """
18059
18060 :param title: text to display in element
18061 :type title: (str)
18062 :param current_value: current value
18063 :type current_value: (int)
18064 :param max_value: max value of progress meter
18065 :type max_value: (int)
18066 :param key: Used with window.find_element and with return values to uniquely identify this element
18067 :type key: str | int | tuple | object
18068 :param *args: stuff to output
18069 :type *args: (Any)
18070 :param orientation: 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v')
18071 :type orientation: (str)
18072 :param bar_color: The 2 colors that make up a progress bar. Either a tuple of 2 strings or a string. Tuple - (bar, background). A string with 1 color changes the background of the bar only. A string with 2 colors separated by "on" like "red on blue" specifies a red bar on a blue background.
18073 :type bar_color: (str, str) or str
18074 :param button_color: button color (foreground, background)
18075 :type button_color: (str, str) | str
18076 :param size: (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE)
18077 :type size: (int, int)
18078 :param border_width: width of border around element
18079 :type border_width: (int)
18080 :param grab_anywhere: If True: can grab anywhere to move the window (Default = False)
18081 :type grab_anywhere: (bool)
18082 :param no_titlebar: If True: window will be created without a titlebar
18083 :type no_titlebar: (bool)
18084 :param keep_on_top: If True the window will remain above all current windows
18085 :type keep_on_top: (bool)
18086 :param no_button: If True: window will be created without a cancel button
18087 :type no_button: (bool)
18088 """
18089 self.start_time = datetime.datetime.utcnow()
18090 self.key = key
18091 self.orientation = orientation
18092 self.bar_color = bar_color
18093 self.size = size
18094 self.grab_anywhere = grab_anywhere
18095 self.button_color = button_color
18096 self.border_width = border_width
18097 self.no_titlebar = no_titlebar
18098 self.title = title
18099 self.current_value = current_value
18100 self.max_value = max_value
18101 self.close_reason = None
18102 self.keep_on_top = keep_on_top
18103 self.no_button = no_button
18104 self.window = self.BuildWindow(*args)
18105
18106 def BuildWindow(self, *args):
18107 layout = []
18108 if self.orientation.lower().startswith('h'):
18109 col = []

Callers 1

one_line_progress_meterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected