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

Method UpdateMeter

PySimpleGUI/PySimpleGUI.py:18135–18150  ·  view source on GitHub ↗
(self, current_value, max_value, *args)

Source from the content-addressed store, hash-verified

18133 return self.window
18134
18135 def UpdateMeter(self, current_value, max_value, *args): ### support for *args when updating
18136
18137 self.current_value = current_value
18138 self.max_value = max_value
18139 self.window.Element('-PROG-').UpdateBar(self.current_value, self.max_value)
18140 self.window.Element('-STATS-').Update('\n'.join(self.ComputeProgressStats()))
18141 self.window.Element('-OPTMSG-').Update(
18142 value=''.join(map(lambda x: str(x) + '\n', args))) ### update the string with the args
18143 event, values = self.window.read(timeout=0)
18144 if event in ('Cancel', None) or current_value >= max_value:
18145 exit_reason = METER_REASON_CANCELLED if event in ('Cancel', None) else METER_REASON_REACHED_MAX if current_value >= max_value else METER_STOPPED
18146 self.window.close()
18147 del (_QuickMeter.active_meters[self.key])
18148 _QuickMeter.exit_reasons[self.key] = exit_reason
18149 return _QuickMeter.exit_reasons[self.key]
18150 return METER_OK
18151
18152 def ComputeProgressStats(self):
18153 utc = datetime.datetime.utcnow()

Callers 1

one_line_progress_meterFunction · 0.80

Calls 4

ComputeProgressStatsMethod · 0.95
UpdateMethod · 0.80
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected