Skip to content

Commit

Permalink
Added text function for writing text
Browse files Browse the repository at this point in the history
  • Loading branch information
theepicsnail committed Apr 16, 2012
1 parent 48a64ec commit bde3cc1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cosketch.py
Expand Up @@ -103,7 +103,11 @@ def event_dispatcher(self):

if event.type in self.event_handlers:
for cb in self.event_handlers[event.type]:
cb(self, event)
try:
cb(self, event)
except:
import traceback
traceback.print_exc()
except:
pass

Expand All @@ -120,6 +124,16 @@ def stroke(self, points, color, width):

data = self.d('["Stroke",0,"%s",%s,%s,255]' % (color,width,points))
self.action_queue.put(data)
def text(self,text,position,color="#000000",size=14):
data = self.d('["Text",{x},{y},"{text}","{color}",{size}]'.format(
x = position[0],
y=position[1],
text=text,
color=color,
size=size))
self.action_queue.put(data)



def set_nick(self, nick):
self.nick = nick.replace('"','\\"')
Expand Down

0 comments on commit bde3cc1

Please sign in to comment.