Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/taconstants.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/taconstants.py')
-rw-r--r--TurtleArt/taconstants.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index a8fc046..0a3cc23 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -151,6 +151,26 @@ REVERSE_KEY_DICT = {
}
+class ColorObj(object):
+ def __init__(self, color):
+ self.color = color
+
+ def __int__(self):
+ if self.color.color is None:
+ return int(self.color.shade)
+ else:
+ return int(self.color.color)
+
+ def __float__(self):
+ return float(int(self))
+
+ def __str__(self):
+ return str(self.color.name)
+
+ def __repr__(self):
+ return str(self.color.name)
+
+
class Color(object):
""" A color used in block programs (e.g., as pen color). """
@@ -176,6 +196,9 @@ class Color(object):
def get_number_string(self):
return str(int(self))
+ def get_number_name(self):
+ return str(self.name)
+
def __str__(self):
return str(self.name)