commit
eae899b612
|
@ -200,6 +200,7 @@ DEFAULT_WINDOW_LOCATION = (None, None)
|
||||||
MAX_SCROLLED_TEXT_BOX_HEIGHT = 50
|
MAX_SCROLLED_TEXT_BOX_HEIGHT = 50
|
||||||
DEFAULT_TOOLTIP_TIME = 400
|
DEFAULT_TOOLTIP_TIME = 400
|
||||||
DEFAULT_TOOLTIP_OFFSET = (0, -20)
|
DEFAULT_TOOLTIP_OFFSET = (0, -20)
|
||||||
|
TOOLTIP_BACKGROUND_COLOR = "#ffffe0"
|
||||||
#################### COLOR STUFF ####################
|
#################### COLOR STUFF ####################
|
||||||
BLUES = ("#082567", "#0A37A3", "#00345B")
|
BLUES = ("#082567", "#0A37A3", "#00345B")
|
||||||
PURPLES = ("#480656", "#4F2398", "#380474")
|
PURPLES = ("#480656", "#4F2398", "#380474")
|
||||||
|
@ -465,7 +466,7 @@ class ToolTip:
|
||||||
self.tipwindow.wm_attributes("-topmost", 1)
|
self.tipwindow.wm_attributes("-topmost", 1)
|
||||||
|
|
||||||
label = ttk.Label(self.tipwindow, text=self.text, justify=tk.LEFT,
|
label = ttk.Label(self.tipwindow, text=self.text, justify=tk.LEFT,
|
||||||
background="#ffffe0", relief=tk.SOLID, borderwidth=1)
|
background=TOOLTIP_BACKGROUND_COLOR, relief=tk.SOLID, borderwidth=1)
|
||||||
label.pack()
|
label.pack()
|
||||||
|
|
||||||
def hidetip(self):
|
def hidetip(self):
|
||||||
|
@ -4409,16 +4410,17 @@ class Table(Element):
|
||||||
size=size, pad=pad, key=key, tooltip=tooltip, visible=visible)
|
size=size, pad=pad, key=key, tooltip=tooltip, visible=visible)
|
||||||
return
|
return
|
||||||
|
|
||||||
def Update(self, values=None, num_rows=None, visible=None, select_rows=None):
|
def Update(self, values=None, num_rows=None, visible=None, select_rows=None, alternating_row_color=None, row_colors=None):
|
||||||
"""
|
"""
|
||||||
Changes some of the settings for the Table Element. Must call `Window.Read` or `Window.Finalize` prior
|
Changes some of the settings for the Table Element. Must call `Window.Read` or `Window.Finalize` prior
|
||||||
|
|
||||||
:param values:
|
:param values: List[List[Any]] A new 2-dimensional table to show
|
||||||
:param num_rows:
|
:param num_rows: (int) How many rows to display at a time
|
||||||
:param visible: (bool) control visibility of element
|
:param visible: (bool) if True then will be visible
|
||||||
:param select_rows:
|
:param select_rows: List[int] List of rows to select as if user did
|
||||||
|
:param alternating_row_color: (str) the color to make every other row
|
||||||
|
:param row_colors: List[Tuple[int, str]] list of tuples of (row, color). Changes the colors of listed rows to the color provided
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if values is not None:
|
if values is not None:
|
||||||
children = self.TKTreeview.get_children()
|
children = self.TKTreeview.get_children()
|
||||||
for i in children:
|
for i in children:
|
||||||
|
@ -4444,6 +4446,20 @@ class Table(Element):
|
||||||
rows_to_select = [i+1 for i in select_rows]
|
rows_to_select = [i+1 for i in select_rows]
|
||||||
self.TKTreeview.selection_set(rows_to_select)
|
self.TKTreeview.selection_set(rows_to_select)
|
||||||
|
|
||||||
|
if alternating_row_color is not None: # alternating colors
|
||||||
|
self.AlternatingRowColor = alternating_row_color
|
||||||
|
|
||||||
|
if self.AlternatingRowColor is not None:
|
||||||
|
for row in range(0, len(self.Values), 2):
|
||||||
|
self.TKTreeview.tag_configure(row, background=self.AlternatingRowColor)
|
||||||
|
if row_colors is not None: # individual row colors
|
||||||
|
self.RowColors = row_colors
|
||||||
|
for row_def in self.RowColors:
|
||||||
|
if len(row_def) == 2: # only background is specified
|
||||||
|
self.TKTreeview.tag_configure(row_def[0], background=row_def[1])
|
||||||
|
else:
|
||||||
|
self.TKTreeview.tag_configure(row_def[0], background=row_def[2], foreground=row_def[1])
|
||||||
|
|
||||||
def treeview_selected(self, event):
|
def treeview_selected(self, event):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue