CommentsΒΆ

In this example we see several ways to insert Pure Data comments on the patch.

 1import pdpy_lib as pdpy
 2
 3with pdpy.PdPy(name='comments', root=True) as pd:
 4
 5  comments = pd.createComment(
 6    "This is a comment",
 7    "This is yet another one, on the same; object",
 8    "note that semis and commas are escaped, internally."
 9  )
10
11  many = 10
12
13  # the function above is a convenience function for the following one
14  another = pdpy.Comment("Now we've made " + str(many) + " comments")
15
16  for n in range(1,many):
17    pd.createComment("we repeated " + str(n) + " times.")
18
19  another.addtext('You can add more text to a comment')
20  pd.create(another)
21  another.addtext('before or after you have created it.')
22
23  # for example, the first comment is returned as a list, so
24  comments[0].addtext('neat, right?')
25
26  final = pd.createComment("Also, you can have very very long texts and specify  your own breaking point, for example by setting the border property to, say, 250")
27  final[0].border = 250