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

Method __init__

PySimpleGUI/PySimpleGUI.py:4603–4664  ·  view source on GitHub ↗

:param root: The root window bar is to be shown in :type root: tk.Tk | tk.TopLevel :param max: Maximum value the bar will be measuring :type max: (int) :param length: length in pixels of the bar :type length:

(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], ttk_theme=DEFAULT_TTK_THEME, style_name='',
                 relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH,
                 orientation='horizontal', BarColor=(None, None), key=None)

Source from the content-addressed store, hash-verified

4601 uniqueness_counter = 0
4602
4603 def __init__(self, root, max, length=400, width=DEFAULT_PROGRESS_BAR_SIZE[1], ttk_theme=DEFAULT_TTK_THEME, style_name='',
4604 relief=DEFAULT_PROGRESS_BAR_RELIEF, border_width=DEFAULT_PROGRESS_BAR_BORDER_WIDTH,
4605 orientation='horizontal', BarColor=(None, None), key=None):
4606 """
4607 :param root: The root window bar is to be shown in
4608 :type root: tk.Tk | tk.TopLevel
4609 :param max: Maximum value the bar will be measuring
4610 :type max: (int)
4611 :param length: length in pixels of the bar
4612 :type length: (int)
4613 :param width: width in pixels of the bar
4614 :type width: (int)
4615 :param style_name: Progress bar style to use. Set in the packer function
4616 :type style_name: (str)
4617 :param ttk_theme: Progress bar style defined as one of these 'default', 'winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative'
4618 :type ttk_theme: (str)
4619 :param relief: relief style. Values are same as progress meter relief values. Can be a constant or a string: `RELIEF_RAISED RELIEF_SUNKEN RELIEF_FLAT RELIEF_RIDGE RELIEF_GROOVE RELIEF_SOLID` (Default value = DEFAULT_PROGRESS_BAR_RELIEF)
4620 :type relief: (str)
4621 :param border_width: The amount of pixels that go around the outside of the bar
4622 :type border_width: (int)
4623 :param orientation: 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical')
4624 :type orientation: (str)
4625 :param BarColor: The 2 colors that make up a progress bar. One is the background, the other is the bar
4626 :type BarColor: (str, str)
4627 :param key: Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
4628 :type key: str | int | tuple | object
4629 """
4630
4631 self.Length = length
4632 self.Width = width
4633 self.Max = max
4634 self.Orientation = orientation
4635 self.Count = None
4636 self.PriorCount = 0
4637 self.style_name = style_name
4638
4639 TKProgressBar.uniqueness_counter += 1
4640
4641 if orientation.lower().startswith('h'):
4642 s = ttk.Style()
4643 _change_ttk_theme(s, ttk_theme)
4644
4645 # self.style_name = str(key) + str(TKProgressBar.uniqueness_counter) + "my.Horizontal.TProgressbar"
4646 if BarColor != COLOR_SYSTEM_DEFAULT and BarColor[0] != COLOR_SYSTEM_DEFAULT:
4647 s.configure(self.style_name, background=BarColor[0], troughcolor=BarColor[1],
4648 troughrelief=relief, borderwidth=border_width, thickness=width)
4649 else:
4650 s.configure(self.style_name, troughrelief=relief, borderwidth=border_width, thickness=width)
4651
4652 self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=self.style_name, length=length, orient=tk.HORIZONTAL, mode='determinate')
4653 else:
4654 s = ttk.Style()
4655 _change_ttk_theme(s, ttk_theme)
4656 # self.style_name = str(key) + str(TKProgressBar.uniqueness_counter) + "my.Vertical.TProgressbar"
4657 if BarColor != COLOR_SYSTEM_DEFAULT and BarColor[0] != COLOR_SYSTEM_DEFAULT:
4658
4659 s.configure(self.style_name, background=BarColor[0],
4660 troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)

Callers

nothing calls this directly

Calls 1

_change_ttk_themeFunction · 0.85

Tested by

no test coverage detected