Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/__init__.py3
-rw-r--r--misc/angles.py8
-rw-r--r--misc/dumpqueue.py20
-rw-r--r--misc/fromresourcefolder.py3
4 files changed, 34 insertions, 0 deletions
diff --git a/misc/__init__.py b/misc/__init__.py
new file mode 100644
index 0000000..d337bdf
--- /dev/null
+++ b/misc/__init__.py
@@ -0,0 +1,3 @@
+"""
+A package of miscellanious stuff for the PythonTurtle package.
+""" \ No newline at end of file
diff --git a/misc/angles.py b/misc/angles.py
new file mode 100644
index 0000000..04fe080
--- /dev/null
+++ b/misc/angles.py
@@ -0,0 +1,8 @@
+"""
+Lambda functions for converting angles between radians
+and degrees
+"""
+import math
+
+deg_to_rad=lambda deg: (deg*math.pi)/180
+rad_to_deg=lambda rad: (rad/math.pi)*180 \ No newline at end of file
diff --git a/misc/dumpqueue.py b/misc/dumpqueue.py
new file mode 100644
index 0000000..5a5b744
--- /dev/null
+++ b/misc/dumpqueue.py
@@ -0,0 +1,20 @@
+"""
+See documentation for dump_queue defined here.
+"""
+import Queue
+
+
+def dump_queue(queue):
+ """
+ Empties all pending items in a queue
+ and returns them in a list.
+ """
+ result=[]
+
+ while True:
+ try:
+ thing=queue.get(block=False)
+ result.append(thing)
+ except Queue.Empty:
+ return result
+
diff --git a/misc/fromresourcefolder.py b/misc/fromresourcefolder.py
new file mode 100644
index 0000000..d5c8320
--- /dev/null
+++ b/misc/fromresourcefolder.py
@@ -0,0 +1,3 @@
+import os
+def from_resource_folder(filename):
+ return os.path.join("resources",filename) \ No newline at end of file