MCPcopy Index your code
hub / github.com/python/cpython / set_color_sample

Method set_color_sample

Lib/idlelib/configdialog.py:990–1006  ·  view source on GitHub ↗

Set the color of the frame background to reflect the selected target. Instance variables accessed: theme_elements highlight_target fg_bg_toggle highlight_sample Attributes updated: frame_color_set

(self)

Source from the content-addressed store, hash-verified

988 self.set_color_sample()
989
990 def set_color_sample(self):
991 """Set the color of the frame background to reflect the selected target.
992
993 Instance variables accessed:
994 theme_elements
995 highlight_target
996 fg_bg_toggle
997 highlight_sample
998
999 Attributes updated:
1000 frame_color_set
1001 """
1002 # Set the color sample area.
1003 tag = self.theme_elements[self.highlight_target.get()]
1004 plane = 'foreground' if self.fg_bg_toggle.get() else 'background'
1005 color = self.highlight_sample.tag_cget(tag, plane)
1006 self.style.configure('frame_color_set.TFrame', background=color)
1007
1008 def paint_theme_sample(self):
1009 """Apply the theme colors to each element tag in the sample text.

Callers 4

set_highlight_targetMethod · 0.95
paint_theme_sampleMethod · 0.95
test_set_color_sampleMethod · 0.80

Calls 3

tag_cgetMethod · 0.80
getMethod · 0.45
configureMethod · 0.45

Tested by 1

test_set_color_sampleMethod · 0.64