Progress Bar Element - Displays a colored bar that is shaded as progress of some operation is made
| 5578 | # ProgreessBar # |
| 5579 | # ---------------------------------------------------------------------- # |
| 5580 | class ProgressBar(Element): |
| 5581 | """ |
| 5582 | Progress Bar Element - Displays a colored bar that is shaded as progress of some operation is made |
| 5583 | """ |
| 5584 | |
| 5585 | def __init__(self, max_value, orientation=None, size=(None, None), s=(None, None), size_px=(None, None), auto_size_text=None, bar_color=None, style=None, border_width=None, |
| 5586 | relief=None, key=None, k=None, pad=None, p=None, right_click_menu=None, expand_x=False, expand_y=False, visible=True, metadata=None): |
| 5587 | """ |
| 5588 | :param max_value: max value of progressbar |
| 5589 | :type max_value: (int) |
| 5590 | :param orientation: 'horizontal' or 'vertical' |
| 5591 | :type orientation: (str) |
| 5592 | :param size: Size of the bar. If horizontal (chars long, pixels wide), vert (chars high, pixels wide). Vert height measured using horizontal chars units. |
| 5593 | :type size: (int, int) | (int, None) |
| 5594 | :param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used |
| 5595 | :type s: (int, int) | (None, None) |
| 5596 | :param size_px: Size in pixels (length, width). Will be used in place of size parm if specified |
| 5597 | :type size_px: (int, int) | (None, None) |
| 5598 | :param auto_size_text: Not sure why this is here |
| 5599 | :type auto_size_text: (bool) |
| 5600 | :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. |
| 5601 | :type bar_color: (str, str) or str |
| 5602 | :param style: Progress bar style defined as one of these 'default', 'winnative', 'clam', 'alt', 'classic', 'vista', 'xpnative' |
| 5603 | :type style: (str) |
| 5604 | :param border_width: The amount of pixels that go around the outside of the bar |
| 5605 | :type border_width: (int) |
| 5606 | :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) |
| 5607 | :type relief: (str) |
| 5608 | :param key: Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element |
| 5609 | :type key: str | int | tuple | object |
| 5610 | :param k: Same as the Key. You can use either k or key. Which ever is set will be used. |
| 5611 | :type k: str | int | tuple | object |
| 5612 | :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int) |
| 5613 | :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 5614 | :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used |
| 5615 | :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int |
| 5616 | :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| 5617 | :type right_click_menu: List[List[ List[str] | str ]] |
| 5618 | :param expand_x: If True the element will automatically expand in the X direction to fill available space |
| 5619 | :type expand_x: (bool) |
| 5620 | :param expand_y: If True the element will automatically expand in the Y direction to fill available space |
| 5621 | :type expand_y: (bool) |
| 5622 | :param visible: set visibility state of the element |
| 5623 | :type visible: (bool) |
| 5624 | :param metadata: User metadata that can be set to ANYTHING |
| 5625 | :type metadata: (Any) |
| 5626 | """ |
| 5627 | |
| 5628 | self.MaxValue = max_value |
| 5629 | self.TKProgressBar = None # type: TKProgressBar |
| 5630 | self.Cancelled = False |
| 5631 | self.NotRunning = True |
| 5632 | self.Orientation = orientation if orientation else DEFAULT_METER_ORIENTATION |
| 5633 | self.RightClickMenu = right_click_menu |
| 5634 | # Progress Bar colors can be a tuple (text, background) or a string with format "bar on background" - examples "red on white" or ("red", "white") |
| 5635 | if bar_color is None: |
| 5636 | bar_color = DEFAULT_PROGRESS_BAR_COLOR |
| 5637 | else: |