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

Method get_color

Lib/idlelib/configdialog.py:846–882  ·  view source on GitHub ↗

Handle button to select a new color for the target tag. If a new color is selected while using a builtin theme, a name must be supplied to create a custom theme. Attributes accessed: highlight_target frame_color_set theme_source

(self)

Source from the content-addressed store, hash-verified

844 self.button_delete_custom.state(('!disabled',))
845
846 def get_color(self):
847 """Handle button to select a new color for the target tag.
848
849 If a new color is selected while using a builtin theme, a
850 name must be supplied to create a custom theme.
851
852 Attributes accessed:
853 highlight_target
854 frame_color_set
855 theme_source
856
857 Attributes updated:
858 color
859
860 Methods:
861 get_new_theme_name
862 create_new
863 """
864 target = self.highlight_target.get()
865 prev_color = self.style.lookup(self.frame_color_set['style'],
866 'background')
867 rgbTuplet, color_string = colorchooser.askcolor(
868 parent=self, title='Pick new color for : '+target,
869 initialcolor=prev_color)
870 if color_string and (color_string != prev_color):
871 # User didn't cancel and they chose a new color.
872 if self.theme_source.get(): # Current theme is a built-in.
873 message = ('Your changes will be saved as a new Custom Theme. '
874 'Enter a name for your new Custom Theme below.')
875 new_theme = self.get_new_theme_name(message)
876 if not new_theme: # User cancelled custom theme creation.
877 return
878 else: # Create new custom theme based on previously active theme.
879 self.create_new(new_theme)
880 self.color.set(color_string)
881 else: # Current theme is user defined.
882 self.color.set(color_string)
883
884 def on_new_color_set(self):
885 "Display sample of new color selection on the dialog."

Callers

nothing calls this directly

Calls 5

get_new_theme_nameMethod · 0.95
create_newMethod · 0.95
getMethod · 0.45
lookupMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected