Selects an index while providing capability to setting the selected color for the index to specific text/background color :param index: specifies which item to change. index starts at 0 and goes to length of values list minus one :type index:
(self, index, highlight_text_color=None, highlight_background_color=None)
| 2907 | |
| 2908 | |
| 2909 | def select_index(self, index, highlight_text_color=None, highlight_background_color=None): |
| 2910 | """ |
| 2911 | Selects an index while providing capability to setting the selected color for the index to specific text/background color |
| 2912 | |
| 2913 | :param index: specifies which item to change. index starts at 0 and goes to length of values list minus one |
| 2914 | :type index: (int) |
| 2915 | :param highlight_text_color: color of the text when this item is selected. |
| 2916 | :type highlight_text_color: (str) |
| 2917 | :param highlight_background_color: color of the background when this item is selected |
| 2918 | :type highlight_background_color: (str) |
| 2919 | """ |
| 2920 | |
| 2921 | if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow |
| 2922 | return |
| 2923 | |
| 2924 | if self._this_elements_window_closed(): |
| 2925 | _error_popup_with_traceback('Error in Listbox.select_item - The window was closed') |
| 2926 | return |
| 2927 | |
| 2928 | if index >= len(self.Values): |
| 2929 | _error_popup_with_traceback('Index {} is out of range for Listbox.select_index. Max allowed index is {}.'.format(index, len(self.Values)-1)) |
| 2930 | return |
| 2931 | |
| 2932 | self.TKListbox.selection_set(index, index) |
| 2933 | |
| 2934 | if highlight_text_color is not None: |
| 2935 | self.widget.itemconfig(index, selectforeground=highlight_text_color) |
| 2936 | if highlight_background_color is not None: |
| 2937 | self.widget.itemconfig(index, selectbackground=highlight_background_color) |
| 2938 | |
| 2939 | |
| 2940 | def set_index_color(self, index, text_color=None, background_color=None, highlight_text_color=None, highlight_background_color=None): |
nothing calls this directly
no test coverage detected