-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJESAPIHelp.html
More file actions
1507 lines (1503 loc) · 68.4 KB
/
JESAPIHelp.html
File metadata and controls
1507 lines (1503 loc) · 68.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html><body>
API Documentation for functions in media.py
_
addArc|<b>addArc</b>(picture, startX, startY, width, height, start, angle[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the arc on<br>
<font color=blue>startX</font>: the x-coordinate of the center of the arc<br>
<font color=blue>startY</font>: the y-coordinate of the center of the arc<br>
<font color=blue>width</font>: the width of the arc<br>
<font color=blue>height</font>: the height of the arc<br>
<font color=blue>start</font>: the start angle of the arc in degrees<br>
<font color=blue>angle</font>: the angle of the arc relative to start in degrees<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, (x,y) coordinates, width, height, two integer angles, and (optionally) a color as input. Adds an outline of an arc starting at (x,y) at an initial angle of "start" with the given width and height. The angle of the arc itself is "angle", which is relative to "start." Default color is black.<br>
<b>Examples:</b>
<pre>
def addSemiCircle(picture, startX, startY, radius, start):
addArc(picture, startX, startY, radius, radius, start, 180)
</pre>
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArc to draw a black arc with equal width and height.<br>
<pre>
def addBlueSemiCircle(picture, startX, startY, radius, start):
addArc(picture, startX, startY, radius, radius, start, 180, blue)
</pre>
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArc to draw a blue arc with equal width and height.
_
addArcFilled|<b>addArcFilled</b>(picture, startX, startY, width, height, start, angle[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the arc on<br>
<font color=blue>startX</font>: the x-coordinate of the center of the arc<br>
<font color=blue>startY</font>: the y-coordinate of the center of the arc<br>
<font color=blue>width</font>: the width of the arc<br>
<font color=blue>height</font>: the height of the arc<br>
<font color=blue>start</font>: the start angle of the arc in degrees<br>
<font color=blue>angle</font>: the angle of the arc relative to start in degrees<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, (x,y) coordinates, width, height, two integer angles, and (optionally) a color as input. Adds a filled arc starting at (x,y) at an initial angle of "start" with the given width and height. The angle of the arc itself is "angle", which is relative to "start." Default color is black.<br>
<b>Examples:</b>
<pre>
def addFilledSemiCircle(picture, startX, startY, radius, start):
addArcFilled(picture, startX, startY, radius, radius, start, 180)
</pre>
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArcFilled to draw a filled black arc with equal width and height.<br>
<pre>
def addBlueFilledSemiCircle(picture, startX, startY, radius, start):
addArcFilled(picture, startX, startY, radius, radius, start, 180, blue)
</pre>
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArcFilled to draw a filled blue arc with equal width and height.
_
addFrameToMovie|<b>addFrameToMovie</b>(frame, movie):<br>
<font color=blue>frame</font>: the filename of the frame to be added to the movie<br>
<font color=blue>movie</font>: the movie object for the frame to be added to<br>
Takes a filename and a Movie object as input. Adds the file as a frame to the end of the movie. addFrameToMovie(movie, frame) is also acceptable.<br>
<b>Example:</b>
<pre>
def addFileToMovie(movie):
picture = pickAFile()
addFrameToMovie(picture, movie)
</pre>
This will allow the user to choose the filename of a picture, and add that picture as the last frame in the specified movie.
_
addLine|<b>addLine</b>(picture, startX, startY, endX, endY[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the line on<br>
<font color=blue>startX</font>: the x position you want the line to start<br>
<font color=blue>startY</font>: the y position you want the line to start<br>
<font color=blue>endX</font>: the x position you want the line to end<br>
<font color=blue>endY</font>: the y position you want the line to end<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, a starting (x, y) position (two numbers), and an ending (x, y) position (two more numbers, four total), and (optionally) a color as input. Adds a line from the starting point to the ending point in the picture. Default color is black.<br>
<b>Examples:</b>
<pre>
def drawVertical(picture):
addLine(picture, 100, 20, 100, 250)
</pre>
This will take in a picture and draw a black vertical line on it from (100,20) to (100,250)<br>
<pre>
def drawDiagonal(picture):
addLine(picture, 0, 15, 100, 115, blue)
</pre>
This will take in a picture and draw a blue diagonal line on it from (0,15) to (100, 115).
_
addOval|<b>addOval</b>(picture, startX, startY, width, height[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the oval on<br>
<font color=blue>startX</font>: the x-coordinate of the upper left-hand corner of the bounding rectangle of the oval<br>
<font color=blue>startY</font>: the y-coordinate of the upper left-hand corner of the bounding rectangle of the oval<br>
<font color=blue>width</font>: the width of the oval<br>
<font color=blue>height</font>: the height of the oval<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds an oval outline of the given dimensions using the (x,y) as the upper left corner of the bounding rectangle. Default color is black.<br>
<b>Examples:</b>
<pre>
def addCircle(picture, startX, startY, radius):
addOval(picture, startX, startY, radius, radius)
</pre>
This will take in a picture, start coordinates, and a radius length and call addOval to draw a black oval with equal width and height.<br>
<pre>
def addBlueCircle(picture, startX, startY, radius):
addOval(picture, startX, startY, radius, radius, blue)
</pre>
This will take in a picture, start coordinates, and a radius length and call addOval to draw a blue oval with equal width and height.
_
addOvalFilled|<b>addOvalFilled</b>(picture, startX, startY, width, height[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the oval on<br>
<font color=blue>startX</font>: the x-coordinate of the upper left-hand corner of the bounding rectangle of the oval<br>
<font color=blue>startY</font>: the y-coordinate of the upper left-hand corner of the bounding rectangle of the oval<br>
<font color=blue>width</font>: the width of the oval<br>
<font color=blue>height</font>: the height of the oval<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a filled oval of the given dimensions using the (x,y) as the upper left corner of the bounding rectangle. Default color is black.<br>
<b>Examples:</b>
<pre>
def addCircleFilled(picture, startX, startY, radius):
addOvalFilled(picture, startX, startY, radius, radius)
</pre>
This will take in a picture, start coordinates, and a radius length and call addOvalFilled to draw a solid oval with equal width and height.<br>
<pre>
def addBlueCircleFilled(picture, startX, startY, radius):
addOvalFilled(picture, startX, startY, radius, radius, blue)
</pre>
This will take in a picture, start coordinates, and a radius length and call addOvalFilled to draw a solid blue oval with equal width and height.
_
addRect|<b>addRect</b>(picture, startX, startY, width, height[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the rectangle on<br>
<font color=blue>startX</font>: the x-coordinate of the upper left-hand corner of the rectangle<br>
<font color=blue>startY</font>: the y-coordinate of the upper left-hand corner of the rectangle<br>
<font color=blue>width</font>: the width of the rectangle<br>
<font color=blue>height</font>: the height of the rectangle<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a rectangular outline of the specified dimensions using the (x,y) as the upper left corner. Default color is black.<br>
<b>Examples:</b>
<pre>
def addSquare(picture, startX, startY, edge):
addRect(picture, startX, startY, edge, edge)
</pre>
This will take in a picture, start coordinates, and an edge length and call addRect to draw a black rectangle with all sides the same length.<br>
<pre>
def addBlueSquare(picture, startX, startY, edge):
addRect(picture, startX, startY, edge, edge, blue)
</pre>
This will take in a picture, start coordinates, and an edge length and call addRect to draw a blue rectangle with all sides the same length.
_
addRectFilled|<b>addRectFilled</b>(picture, startX, startY, width, height[, color]):<br>
<font color=blue>picture</font>: the picture you want to draw the rectangle on<br>
<font color=blue>startX</font>: the x-coordinate of the upper left-hand corner of the rectangle<br>
<font color=blue>startY</font>: the y-coordinate of the upper left-hand corner of the rectangle<br>
<font color=blue>width</font>: the width of the rectangle<br>
<font color=blue>height</font>: the height of the rectangle<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a filled rectangle of the specified dimensions using the (x,y) as the upper left corner. Default color is black.<br>
<b>Examples:</b>
<pre>
def addSquareFilled(picture, startX, startY, edge):
addRectFilled(picture, startX, startY, edge, edge)
</pre>
This will take in a picture, start coordinates, and an edge length and call addRectFilled to draw a solid black rectangle with all sides the same length.<br>
<pre>
def addBlueSquareFilled(picture, startX, startY, edge):
addRectFilled(picture, startX, startY, edge, edge, blue)
</pre>
This will take in a picture, start coordinates, and an edge length and call addRectFilled to draw a solid blue rectangle with all sides the same length.
_
addText|<b>addText</b>(picture, xpos, ypos, text[, color]):<br>
<font color=blue>picture</font>: the picture you want to add the text to<br>
<font color=blue>xpos</font>: the x-coordinate where you want to start writing the text<br>
<font color=blue>ypos</font>: the y-coordinate where you want to start writing the text<br>
<font color=blue>text</font>: a string containing the text you want written<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, an x position and a y position (two numbers), and some text as a string, which will get drawn into the picture, in the specified color. Default color is black.<br>
<b>Examples:</b>
<pre>
def addDate(picture):
str = "Today is the first day of the rest of your life."
addText(picture, 0, 0, str)
</pre>
This takes in a picture and adds a black date stamp to the upper left corner.<br>
<pre>
def addHappyBirthday(picture):
str = "Happy Birthday!!!"
addText(picture, 0, 0, str, orange)
</pre>
This takes in a picture and adds an orange Happy Birthday message to the upper left corner.<br>
_
addTextWithStyle|<b>addTextWithStyle</b>(picture, xpos, ypos, text, style[, color]):<br>
<font color=blue>picture</font>: the picture you want to add the text to<br>
<font color=blue>xpos</font>: the x-coordinate where you want to start writing the text<br>
<font color=blue>ypos</font>: the y-coordinate where you want to start writing the text<br>
<font color=blue>text</font>: a string containing the text you want written<br>
<font color=blue>style</font>: a font created using makeStyle()<br>
<font color=blue>color</font>: the color you want to draw in (optional)<br>
Takes a picture, an x position and a y position (two numbers), and some text as a string, which will get drawn into the picture, in the given font style and specified color. Default color is black.<br>
<b>Examples:</b>
<pre>
def addDate(picture):
import java.awt.Font as Font
str = "Today is the first day of the rest of your life."
myFont = makeStyle("Comic Sans", Font.BOLD, 96)
addTextWithStyle(picture, 0, 0, str, myFont)
</pre>
This takes in a picture and adds a black date stamp to the upper left corner in Size 96 bold Comic Sans.<br>
<pre>
def addHappyBirthday(picture):
import java.awt.Font as Font
str = "Happy Birthday!!!"
myFont = makeStyle("Wingdings", Font.ITALICS, 24)
addText(picture, 0, 0, str, orange)
</pre>
This takes in a picture and adds an orange Happy Birthday message to the upper left corner in Size 24 italcized Wingdings.<br>
_
backward|<b>backward</b>(turtle[, distance]):<br>
<font color=blue>turtle</font>: the turtle to operate on<br>
<font color=blue>distance</font>: how far to go, in pixels (optional)<br>
Moves the turtle opposite to the direction it's facing. Default distance is 100 pixels.<br>
<b>Example</b>
<pre>
def moveTurtleBackward50():
w = makeWorld()
t = makeTurtle(w)
backward(t, 50)
</pre>
This creates a new turtle and moves it backward 50 pixels.
<pre>
def moveTurtleBackward100():
w = makeWorld()
t = makeTurtle(w)
backward(t)
</pre>
This creates a new turtle and moves it backward the default number of pixels (100).
_
blockingPlay|<b>blockingPlay</b>(sound):<br>
<font color=blue>sound</font>: the sound that you want to play<br>
Plays the sound provided as input, and makes sure that no other sound plays at the exact same time. (Try two play's right after each other.)<br>
<b>Example:</b>
<pre>
def playSoundTwice():
sound = makeSound(r"C:\My Sounds\preamble.wav")
blockingPlay(sound)
blockingPlay(sound)
</pre>
This will play the preamble.wav twice, back-to-back.
_
copyInto|<b>copyInto</b>(smallPicture, bigPicture, startX, startY):<br>
<font color=blue>smallPicture</font>: the picture to paste into the big picture<br>
<font color=blue>bigPicture</font>: the picture to be modified<br>
<font color=blue>startX</font>: the X coordinate of where to place the small picture on the big one<br>
<font color=blue>startY</font>: the Y coordinate of where to place the small picture on the big one<br>
Takes two pictures, a x position and a y position as input, and modifies bigPicture by copying into it as much of smallPicture as will fit, starting at the x,y position in the destination picture.<br>
<b>Example:</b>
<pre>
def addBorder(picture, borderWidth, borderHeight, borderColor):
canvas = makeEmptyPicture( getWidth(picture) + 2*borderWidth, getHeight(picture) + 2*borderHeight, borderColor )
copyInto(picture, canvas, borderWidth, borderHeight)
return canvas
</pre>
This will take in a picture, and return a new picture which is the original plus a border of specified size and color.
_
distance|<b>distance</b>(color1, color2):<br>
<font color=blue>color1</font>: the first color you want compared<br>
<font color=blue>color2</font>: the second color you want compared<br>
<font color=blue>returns</font>: a floating point number representing the Cartesian distance between the colors<br>
Takes two Color objects and returns a single number representing the distance between the colors. The red, green, and blue values of the colors are taken as a point in (x, y, z) space, and the Cartesian distance is computed.<br>
<b>Example:</b>
<pre>
def showDistRedAndBlue():
red = makeColor(255, 0, 0)
blue = makeColor(0, 0, 255)
print distance(red, blue)
</pre>
This will print the distance between red and blue, 360.62445840513925.
_
drop|<b>drop</b>(turtle, picture):<br>
<font color=blue>turtle</font>: the turtle that will do the dropping<br>
<font color=blue>picture</font>: the picture that the turtle will drop<br>
The turtle drops a picture where it is currently sitting, rotated so that
the top of the picture points where the turtle is facing. This, for
example, is one way to flip a picture upside-down.<br>
<b>Example:</b>
<pre>
def dropUpsidedownPic():
w = makeWorld()
t = makeTurtle(w)
moveTo(t, 640, 480)
pic = makePicture(pickAFile())
turn(t, 180)
drop(t, pic)
</pre>
This allows the user to select a picture file, moves the turtle and drops the picture upside-down. The upper-left corner of the picture will be placed in the lower-right corner of the world.
_
duplicatePicture|<b>duplicatePicture</b>(pic):<br>
<font color=blue>pic</font>: the picture that you want to duplicate<br>
<font color=blue>returns</font>: a new picture object with the same image as the original<br>
Takes a picture as input and returns a new picture object with the same image as the original.<br>
<b>Example:</b>
<pre>
file = pickAFile()
mypic = makePicture(file)
copyofmypic = duplicatePicture(mypic)
</pre>
This opens up a file chooser, makes a Picture object using the chosen file, and then creates a second Picture object by copying the first one.
_
duplicateSound|<b>duplicateSound</b>(sound):<br>
<font color=blue>sound</font>: the sound you want to duplicate<br>
<font color=blue>returns</font>: a new Sound object with the same Sample values as the original<br>
Takes a sound as input and returns a new Sound object with the same Sample values as the original.<br>
<b>Example:</b>
<pre>
file = pickAFile()
mysound = makeSound(file)
copyofmysound = duplicateSound(mysound)
</pre>
This opens up a file chooser, makes a Sound object using the chosen file, and then creates a second Sound object by copying the first one.
_
explore|<b>explore</b>(someMedia):<br>
<font color=blue>someMedia</font>: A Picture, Sound, or Movie that you want to view using Media Tools.<br>
<b>Example:</b>
<pre>
def exploreAPicture():
file = pickAFile()
pic = makePicture(file)
explore(pic)
</pre>
This creates a Picture object from a file and opens it in the Media Tools.
_
forward|<b>forward</b>(turtle[, distance]):<br>
<font color=blue>turtle</font>: the turtle to operate on<br>
<font color=blue>distance</font>: how far to go, in pixels (optional)<br>
Moves the turtle in the direction it's facing. Default distance is 100 pixels.<br>
<b>Example</b>
<pre>
def moveTurtleForward50():
w = makeWorld()
t = makeTurtle(w)
forward(t, 50)
</pre>
This creates a new turtle and moves it forward 50 pixels.
<pre>
def moveTurtleForward100():
w = makeWorld()
t = makeTurtle(w)
forward(t)
</pre>
This creates a new turtle and moves it forward the default number of pixels (100).
_
getAllPixels|<b>getAllPixels</b>(picture):<br>
<font color=blue>picture</font>: the picture you want to get the pixels from<br>
<font color=blue>returns</font>: a list of all the pixels in the picture<br>
Takes a picture as input and returns the sequence of Pixel objects in the picture. (Same as getPixels)<br>
<b>Example:</b>
<pre>
def getTenthPixel(picture):
pixels = getAllPixels(picture)
return pixels[9]
</pre>
This takes in a picture and returns the 10th pixel in that picture.
_
getBlue|<b>getBlue</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to get the amount of blue from<br>
<font color=blue>returns</font>: the blue value of the pixel<br>
Takes a Pixel object and returns the value (between 0 and 255) of the amount of blueness in that pixel.<br>
<b>Example:</b>
<pre>
def getHalfBlue(pixel):
blue = getBlue(pixel)
return blue / 2
</pre>
This takes in a pixel and returns the amount of blue in that pixel divided by two.
_
getColor|<b>getColor</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to extract the color from<br>
<font color=blue>returns</font>: the color of the pixel<br>
Takes a Pixel and returns the Color object at that pixel.<br>
<b>Example:</b>
<pre>
def getDistanceFromRed(pixel):
red = makeColor(255, 0, 0)
col = getColor(pixel)
return distance(red, col)
</pre>
This takes in a pixel and returns that pixel's color's distance from red.
_
getColorWrapAround|<b>getColorWrapAround</b>():<br>
<font color=blue>returns</font>: a boolean (1/true or 0/false) for the current value of ColorWrapAround<br>
Takes no input, and returns the current value of ColorWrapAround. If it is true, color values will wrap-around (356 mod 256 = 100); if false, color values lower than 0 will be forced to 0 and higher than 255 forced to 255. Default is false.<br>
If setColorWrapAround has <b>not</b> been used since re-saving options or restarting JES, This will return the value in the JES options menu. Otherwise, it will return the last flag specified in setColorWrapAround(flag).<br>
<b>Example:</b>
<pre>
def setColorWithoutWrap(pixel, r, g, b):
oldWrapVal = getColorWrapAround()
setColorWrapAround(0)
setColor( pixel, makeColor(r, g, b) )
setColorWrapAround(oldWrapVal)
</pre>
This will temporarily disable colorWrapAround (if enabled), change the pixel's color, and then restore the colorWrapAround to the initial value.
_
getDuration|<b>getDuration</b>(sound):<br>
<font color=blue>sound</font>: the sound you want to find the length of (in seconds)<br>
<font color=blue>returns</font>: the number of seconds the sound lasts<br>
Takes a sound as input and returns the number of seconds that sound lasts.<br>
<b>Example:</b>
<pre>
def songLength():
sound = makeSound(r"C:\My Sounds\2secondsong.wav")
print getDuration(sound)
</pre>
This will print out the number of seconds in the sound. For a song with 88000 samples at 44kHz, it will print out "2.0"
_
getGreen|<b>getGreen</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to get the amount of green from<br>
<font color=blue>returns</font>: the green value of the pixel<br>
Takes a Pixel object and returns the value (between 0 and 255) of the amount of greenness in that pixel.<br>
<b>Example:</b>
<pre>
def getHalfGreen(pixel):
green = getGreen(pixel)
return green / 2
</pre>
This takes in a pixel and returns the amount of green in that pixel divided by two.
_
getHeading|<b>getHeading</b>(turtle):<br>
<font color=blue>turtle</font>: the turtle to get the heading of<br>
<font color=blue>returns</font>: a floating point number representing the heading of the turtle<br>
Returns the degrees of the direction the turtle is facing. (0 degrees is straight up, and heading increases clockwise)<br>
<b>Example:</b>
<pre>
def turtleRightTriangleAngle():
w = makeWorld()
t = makeTurtle(w)
t2 = makeTurtle(w)
turnRight(t2)
forward(t2)
turnLeft(t2)
forward(t2, 50)
turnToFace(t, t2)
return getHeading(t)
</pre>
This will calculate the larger of the two acute angles in the right triangle with side lengths 50 and 100 using turtles. (~63.43 degrees)
_
getHeight|<b>getHeight</b>(picture):<br>
<font color=blue>picture</font>: the picture you want to get the height of<br>
<font color=blue>returns</font>: the height of the picture<br>
Takes a picture as input and returns its length in the number of pixels top-to-bottom in the picture.<br>
<b>Example:</b>
<pre>
def howTall(picture)
height = getHeight(picture)
print "The picture is " + str(height) + " pixels tall."
</pre>
This takes in a picture and prints a descriptive message about its height.
_
getLength|<b>getLength</b>(sound):<br>
<font color=blue>sound</font>: the sound you want to find the length of (how many samples it has)<br>
<font color=blue>returns</font>: the number of samples in sound<br>
Takes a sound as input and returns the number of samples in that sound.<br>
<b>Example:</b>
<pre>
def songLength():
sound = makeSound(r"C:\My Sounds\2secondsong.wav")
print getLength(sound)
</pre>
This will print out the number of samples in the sound. For a 2 second song at 44kHz, it will print out 88000.
_
getMediaFolder|<b>getMediaFolder</b>(filename):<br>
<font color=blue>filename</font>: the name of the file you want (optional)<br>
<font color=blue>returns</font>: the complete path to the file specified<br>
This function builds the whole path to the file you specify, as long as you've already used setMediaFolder() or setMediaPath() to pick out the place where you keep your media. If no filename is given, only the MediaFolder will be returned.<br>
<b>Example:</b>
<pre>
def getFullPathToMarysSong():
setMediaFolder("C:\\")
return getMediaFolder("MarysSong.wav")
</pre>
This set the MediaFolder to C:\ and will return the full path of MarysSong.wav ('C:\\MarysSong.wav').
<pre>
def getAndSetMediaFolder():
setMediaFolder("C:\\")
return getMediaFolder()
</pre>
This set the MediaFolder to C:\ and will then return it ('C:\\').
_
getMediaPath|<b>getMediaPath</b>(filename):<br>
<font color=blue>filename</font>: the name of the file you want (optional)<br>
<font color=blue>returns</font>: the complete path to the file specified<br>
This function builds the whole path to the file you specify, as long as you've already used setMediaFolder() or setMediaPath() to pick out the place where you keep your media. If no filename is given, only the MediaPath will be returned. (Same as getMediaFolder)<br>
<b>Example:</b>
<pre>
def getFullPathToMarysSong():
setMediaPath("C:\\")
return getMediaPath("MarysSong.wav")
</pre>
This set the MediaPath to C:\ and will return the full path of MarysSong.wav ('C:\\MarysSong.wav').
<pre>
def getAndSetMediaPath():
setMediaPath("C:\\")
return getMediaPath()
</pre>
This set the MediaPath to C:\ and will then return it ('C:\\').
_
getNumSamples|<b>getNumSamples</b>(sound):<br>
<font color=blue>sound</font>: the sound you want to find the length of (how many samples it has)<br>
<font color=blue>returns</font>: the number of samples in sound<br>
Takes a sound as input and returns the number of samples in that sound.<br>
<b>Example:</b>
<pre>
def songLength():
sound = makeSound(r"C:\My Sounds\2secondsong.wav")
print getNumSamples(sound)
</pre>
This will print out the number of samples in the sound. For a 2 second song at 44kHz, it will print out 88000.
_
getPixel|<b>getPixel</b>(picture, xpos, ypos):<br>
<font color=blue>picture</font>: the picture you want to get the pixel from<br>
<font color=blue>xpos</font>: the x-coordinate of the pixel you want<br>
<font color=blue>ypos</font>: the y-coordinate of the pixel you want<br>
Takes a picture, an x position and a y position (two numbers), and returns the Pixel object at that point in the picture. (Same as getPixelAt)<br>
<b>Example:</b>
<pre>
def getUpperLeftPixel(picture)
return getPixel(picture, 0, 0)
</pre>
This will take in a picture and return the pixel in the upper left-hand corner, (0, 0).
_
getPixelAt|<b>getPixelAt</b>(picture, xpos, ypos):<br>
<font color=blue>picture</font>: the picture you want to get the pixel from<br>
<font color=blue>xpos</font>: the x-coordinate of the pixel you want<br>
<font color=blue>ypos</font>: the y-coordinate of the pixel you want<br>
Takes a picture, an x position and a y position (two numbers), and returns the Pixel object at that point in the picture.<br>
<b>Example:</b>
<pre>
def getUpperLeftPixel(picture)
return getPixelAt(picture, 0, 0)
</pre>
This will take in a picture and return the pixel in the upper left-hand corner, (0, 0).
_
getPixels|<b>getPixels</b>(picture):<br>
<font color=blue>picture</font>: the picture you want to get the pixels from<br>
<font color=blue>returns</font>: a list of all the pixels in the picture<br>
Takes a picture as input and returns the sequence of Pixel objects in the picture.<br>
<b>Example:</b>
<pre>
def getTenthPixel(picture):
pixels = getPixels(picture)
return pixels[9]
</pre>
This takes in a picture and returns the 10th pixel in that picture.
_
getRed|<b>getRed</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to get the amount of red from<br>
<font color=blue>returns</font>: the red value of the pixel<br>
Takes a Pixel object and returns the value (between 0 and 255) of the amount of redness in that pixel.<br>
<b>Example:</b>
<pre>
def getHalfRed(pixel):
red = getRed(pixel)
return red / 2
</pre>
This takes in a pixel and returns the amount of red in that pixel divided by two.
_
getSampleObjectAt|<b>getSampleObjectAt</b>(sound, index):<br>
<font color=blue>sound</font>: the sound you want to get the sample from<br>
<font color=blue>index</font>: the index of the sample you want to get<br>
<font color=blue>returns</font>: the sample object at that index<br>
Takes a sound and an index (an integer value), and returns the Sample object at that index.<br>
<b>Example:</b>
<pre>
def getTenthSample(sound):
samp = getSampleObjectAt(sound, 9)
return samp
</pre>
This takes a sound, and returns the 10th sample in the sound.
_
getSamples|<b>getSamples</b>(sound):<br>
<font color=blue>sound</font>: A Sound, the sound you want to extract the samples from<br>
<font color=blue>returns</font>: A collection of all the samples in the sound<br>
Takes a sound as input and returns the Samples in that sound.<br>
<b>Example:</b>
<pre>
def printFirstTen(sound):
samps = getSamples(sound)
for num in range(0, 10):
print samps[num]
</pre>
This will take in a sound and print the first 10 samples in that sound
_
getSampleValue|<b>getSampleValue</b>(sample):<br>
<font color=blue>sample</font>: a sample of a sound<br>
<font color=blue>returns</font>: the integer value of that sample<br>
Takes a Sample object and returns its value (between -32768 and 32767). (Formerly getSample)<br>
<b>Example:</b>
<pre>
def sampleToInt(sample):
return getSampleValue(sample)
</pre>
This will convert a sample object into an integer.
_
getSampleValueAt|<b>getSampleValueAt</b>(sound, index):<br>
<font color=blue>sound</font>: the sound you want to get the sample from<br>
<font color=blue>index</font>: the index of the sample you want to get the value of<br>
Takes a sound and an index (an integer value), and returns the value of the sample (between -32768 and 32767) for that object.<br>
<b>Example:</b>
<pre>
def getTenthSampleValue(sound):
num = getSampleValueAt(sound, 9)
return num
</pre>
This will take in a sound and return the integer value of the tenth sample
_
getSamplingRate|<b>getSamplingRate</b>(sound):<br>
<font color=blue>sound</font>: the sound you want to get the sampling rate from<br>
<font color=blue>returns</font>: the integer value representing the number of samples per second<br>
Takes a sound as input and returns the number representing the number of samples in each second for the sound.<br>
<b>Example:</b>
<pre>
def getDoubleSamplingRate(sound):
rate = getSamplingRate(sound)
return (rate * 2)
</pre>
This will take in a sound an return the sampling rate multiplied by 2.
_
getShortPath|<b>getShortPath</b>(path):<br>
<font color=blue>path</font>: a path to a file, as a string<br>
<font color=blue>returns</font>: a shorter, non-absolute version of that path<br>
Takes a file path as input and returns the short version of that path.<br>
<b>Example:</b>
<pre>
print getShortPath("c:\\images\\kittens\\fluffy.jpg")
</pre>
This will print the short path of "c:\images\kittens\fluffy.jpg" which is "kittens\fluffy.jpg".
_
getSound|<b>getSound</b>(sample):<br>
<font color=blue>sample</font>: a sample belonging to a sound<br>
<font color=blue>return</font>: the sound the sample belongs to<br>
Takes a Sample object and returns the Sound that it belongs to.<br>
<b>Example:</b>
<pre>
def getSamplesFromAnySample(sample):
sound = getSound(sample)
return getSamples(sound)
</pre>
This will take in a sample and return the list of samples from the original sound.
_
getTurtleList|<b>getTurtleList</b>(world):<br>
<font color=blue>world</font>: the world to get the turtles from<br>
<font color=blue>returns</font>: the list of turtles in the world<br>
Returns a list of all turtles in the specified world. (You could, for example, tell each one to do something)<br>
<b>Example:</b>
<pre>
def turtleDuel():
w = makeWorld()
t = makeTurtle(w)
t2 = makeTurtle(w)
turn(t2, 180)
for turtle in getTurtleList(w):
forward(turtle, 50)
turn(turtle, 180)
</pre>
This creates a world with two turtles. The second turtle turns around 180 degrees, then both turtles move forward 50 pixels and turn to face each other.
_
getWidth|<b>getWidth</b>(picture):<br>
<font color=blue>picture</font>: the picture you want to get the width of<br>
<font color=blue>returns</font>: the width of the picture<br>
Takes a picture as input and returns its length in the number of pixels left-to-right in the picture.<br>
<b>Example:</b>
<pre>
def howWide(picture)
width = getWidth(picture)
print "The picture is " + str(width) + " pixels wide."
</pre>
This takes in a picture and prints a descriptive message about its width.
_
getX|<b>getX</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to find the x-coordinate of<br>
<font color=blue>returns</font>: the x-coordinate of the pixel<br>
Takes in a pixel object and returns the x position of where that pixel is in the picture.<br>
<b>Example:</b>
<pre>
def getHalfX(pixel):
pos = getX(pixel)
return pos / 2
</pre>
This will take in a pixel and return half of its x-coordinate.
_
getXPos|<b>getXPos</b>(turtle):<br>
<font color=blue>turtle</font>: the turtle to get the x position of<br>
<font color=blue>returns</font>: the x position of the turtle<br>
Returns the x coordinate of the turtle's location.<br>
<b>Example:</b>
<pre>
def getDefaultTurtleXPos():
w = makeWorld()
todd = makeTurtle(w)
return getXPos(todd)
</pre>
This will create a world of default size (640x480), place a turtle in the center, and return its x position (320).
_
getY|<b>getY</b>(pixel):<br>
<font color=blue>pixel</font>: the pixel you want to find the y-coordinate of<br>
<font color=blue>returns</font>: the y-coordinate of the pixel<br>
Takes in a pixel object and returns the y position of where that pixel is in the picture.<br>
<b>Example:</b>
<pre>
def getHalfY(pixel):
pos = getY(pixel)
return pos / 2
</pre>
This will take in a pixel and return half of its y-coordinate.
_
getYPos|<b>getYPos</b>(turtle):<br>
<font color=blue>turtle</font>: the turtle to get the y position of<br>
<font color=blue>returns</font>: the y position of the turtle<br>
Returns the y coordinate of the turtle's location.<br>
<b>Example:</b>
<pre>
def getDefaultTurtleYPos():
w = makeWorld()
timmy = makeTurtle(w)
return getYPos(timmy)
</pre>
This will create a world of default size (640x480), place a turtle in the center, and return its y position (240).
_
makeBrighter|<b>makeBrighter</b>(color):<br>
<font color=blue>color</font>: the color you want to lighten<br>
<font color=blue>returns</font>: the new, lighter color<br>
Takes a color and returns a slightly lighter version of the original color. (Same as makeLighter)<br>
<b>Example:</b>
<pre>
def makeMuchBrighter(color):
return makeBrighter(makeBrighter(makeBrighter(color)))
</pre>
Takes in a color and returns a much lighter version of it by calling makeBrighter three times.
_
makeColor|<b>makeColor</b>(red[, green, blue]):<br>
<font color=blue>red</font>: the amount of red you want in the color (or a Color object you want to duplicate) <br>
<font color=blue>green</font>: the amount of green you want in the color (optional)<br>
<font color=blue>blue</font>: the amount of blue you want in the picture (optional)<br>
<font color=blue>returns</font>: the color made from the inputs<br>
Takes three integer inputs for the red, green, and blue components (in order) and returns a color object. If green and blue are omitted, the red value is used as the intensity of a gray color. Also it works with only a color as input and returns a new color object with the same RGB values as the original.<br>
<b>Examples:</b>
<pre>
def makeCyan():
return makeColor(0, 255, 255)
</pre>
This will return the color cyan.
<pre>
def makeGrey(amount):
return makeColor(amount, amount, amount)
</pre>
This will take in an amount and make a grey color based on that.
<pre>
def duplicateColor(color):
return makeColor(amount, amount, amount)
</pre>
This will take in a color and return a duplicate color object.
_
makeDarker|<b>makeDarker</b>(color):<br>
<font color=blue>color</font>: the color you want to darken<br>
<font color=blue>returns</font>: the new, darker color<br>
Takes a color and returns a slightly darker version of the original color.<br>
<b>Example:</b>
<pre>
def makeMuchDarker(color):
return makeDarker(makeDarker(makeDarker(color)))
</pre>
Takes in a color and returns a much darker version of it by calling makeDarker three times.
_
makeEmptyPicture|<b>makeEmptyPicture</b>(width, height[, color]):<br>
<font color=blue>width</font>: the width of the empty picture<br>
<font color=blue>height</font>: height of the empty picture<br>
<font color=blue>color</font>: background color of the empty picture (optional)<br>
<font color=blue>returns</font>: a new picture object with all the pixels set to the specified color<br>
Makes a new "empty" picture and returns it to you. The width and height must be between 0 and 10000. Default color is white.<br>
<b>Examples:</b>
<pre>
def makeEmptySquare(edge):
return makeEmptyPicture(edge, edge)
</pre>
This will take in an edge length and call makeEmptyPicture to return an empty white picture all sides the same length.
<pre>
def makeEmptyBlueSquare(edge):
return makeEmptyPicture(edge, edge, blue)
</pre>
This will take in an edge length and call makeEmptyPicture to return an empty blue picture all sides the same length.
_
makeEmptySound|<b>makeEmptySound</b>(numSamples[, samplingRate]):<br>
<font color=blue>numSamples</font>: the number of samples in the sound<br>
<font color=blue>samplingRate</font>: the integer value representing the number of samples per second (optional)<br>
<font color=blue>returns</font>: an empty sound with the given number of samples and sampling rate<br>
Takes one or two integers as input. Returns an empty Sound object with the given number of samples and (optionally) the given sampling rate. Default rate is 22050 bits/second. The resulting sound must not be longer than 600 seconds. Prints an error statement if numSamples or samplingRate are less than 0, or if (numSamples/samplingRate) > 600.<br>
<b>Examples:</b>
<pre>
def make10SecondSound():
return makeEmptySound(10 * 22050)
</pre>
This will return an empty sound lasting 10 seconds long, using the default sampling rate (22050 bits/second).
<pre>
def make10SecondSoundWithSamplingRate(samplingRate):
return makeEmptySound(10 * samplingRate, samplingRate)
</pre>
This will return an empty sound lasting 10 seconds long, using the given sampling rate.
_
makeEmptySoundBySeconds|<b>makeEmptySoundBySeconds</b>(duration[, samplingRate]):<br>
<font color=blue>duration</font>: the time in seconds for the duration of the sound<br>
<font color=blue>samplingRate</font>: the integer value representing the number of samples per second of sound (optional)<br>
<font color=blue>returns</font>: An Empty Sound.<br>
Takes a floating point number and optionally an integer as input. Returns an empty Sound object of the given duration and (optionally) the given sampling rate. Default rate is 22050 bits/second. If the given arguments do not multiply to an integer, the number of samples is rounded up. Prints an error statement if duration or samplingRate are less than 0, or if duration > 600.<br>
<b>Examples:</b>
<pre>
def make10SecondSound():
return makeEmptySoundBySeconds(10)
</pre>
This will return an empty sound lasting 10 seconds long, using the default sampling rate (22050 bits/second).
<pre>
def make10SecondSoundWithSamplingRate(samplingRate):
return makeEmptySoundBySecons(10, samplingRate)
</pre>
This will return an empty sound lasting 10 seconds long, using the given sampling rate.
_
makeLighter|<b>makeLighter</b>(color):<br>
<font color=blue>color</font>: the color you want to lighten<br>
<font color=blue>returns</font>: the new, lighter color<br>
Takes a color and returns a slightly lighter version of the original color. This does the same thing as makeBrighter(color).<br>
<b>Example:</b>
<pre>
def makeMuchLighter(color):
return makeLighter(makeLighter(makeLighter(color)))
</pre>
Takes in a color and returns a much lighter version of it by calling makeLighter three times.
_
makeMovie|<b>makeMovie</b>():<br>
<font color=blue>returns</font>: an empty Movie object.<br><br>
<b>Example:</b>
<pre>
def makeSingleFramedMovie():
picture = pickAFile()
movie = makeMovie()
addFrameToMovie(picture, movie)
return movie
</pre>
This will allow the user to choose the filename of a picture, and add that picture as the only frame to a new movie. The single framed movie is then returned.
_
makeMovieFromInitialFile|<b>makeMovieFromInitialFile</b>(filename):<br>
<font color=blue>filename</font>: string path to the first frame of the movie.<br>
<font color=blue>returns</font>: a Movie object using the given file as the first frame<br>
Takes a filename as input. Returns a Movie object using the given file as the first frame and using sequentially named files for subsequent frames (i.e. frame001, frame002, etc.)<br>
<b>Example:</b>
<pre>
def createNewMovie():
file = pickAFile()
return makeMovieFromInitialFile(file)
</pre>
This opens up a file selector dialog. The user picks a picture file, and the function returns a Movie with the given file as the first frame.
_
makePicture|<b>makePicture</b>(path):<br>
<font color=blue>path</font>: the name of the file you want to open as a
picture<br>
<font color=blue>returns</font>: a picture object made from the file<br>
Takes a filename as input, reads the file, and creates a picture from it.
Returns the picture.<br>
<b>Example:</b>
<pre>
def makePictureSelector():
file = pickAFile()
return makePicture(file)
</pre>
This function will open a file selector box and then return the picture
object made from that file.
_
makeSound|<b>makeSound</b>(path):<br>
<font color=blue>path</font>: a string path of a wav file<br>
<font color=blue>returns</font>: the sound created from the file at the given path<br>
Takes a filename as input, reads the file, and creates a sound from it. Returns the sound.<br>
<b>Example:</b>
<pre>
def openAnySound():
file = pickAFile()
return makeSound(file)
</pre>
This opens up a file selector dialog. The user picks a file, and the function returns it as a sound.
_
makeStyle|<b>makeStyle</b>(fontName, emphasis, size):<br>
<font color=blue>fontName</font>: the name of the font you want in the style (sansSerif, serif, mono)<br>
<font color=blue>emphasis</font>: the type of emphasis you want in the style (italic, bold, italic + bold, plain)<br>
<font color=blue>size</font>: the size of the font you want in the style<br>
<font color=blue>returns</font>: the style made from the inputs<br>
Takes a font name, emphasis, and size in points as input. Returns a Font object with the given parameters.<br>
<b>Example:</b>
<pre>
def makeBold12ptSerifFont():
return makeStyle(sansSerif, bold, 12)
</pre>
This takes no input and will return a Font that is san-serif, bold, and of size 12pt.
_
makeTurtle|<b>makeTurtle</b>(world):<br>
<font color=blue>world</font>: a world to put the turtle in<br>
<font color=blue>returns</font>: the new turtle<br>
Makes a turtle and returns it<br>
<b>Example:</b>
<pre>
def turtleForward():
w = makeWorld()
t = makeTurtle(w)
forward(t)
</pre>
This creates a new turtle and moves it forward 100 pixels.
_
makeWorld|<b>makeWorld</b>([width, height]):<br>
<font color=blue>width</font>: the width for your new world (optional)<br>
<font color=blue>height</font>: the height for your new world (optional)<br>
<font color=blue>returns</font>: the new world<br>
Returns a new world of the specified size, where you can put turtles. Default size is 640x480.<br>
<b>Example:</b>
<pre>
def makeDefaultWorld():
earth = makeWorld()
</pre>
This creates a world with the default size (640x480).
<pre>
def makeSmallerWorld():
mars = makeWorld(500, 500)
</pre>
This creates a smaller world of size 500x500.
_
moveTo|<b>moveTo</b>(turtle, x, y):<br>
<font color=blue>turtle</font>: the turtle to operate on<br>
<font color=blue>x</font>: the x coordinate in the world to move to<br>
<font color=blue>y</font>: the y coordinate in the world to move to<br>
Moves the turtle to the specified location. If the turtle's pen is down, it
draws a line from its old position to the new one.<br>
<b>Example:</b>
<pre>
def moveTurtleTo():
w = makeWorld()
t = makeTurtle(w)
moveTo(t, 150, 150)
</pre>
This will create a new turtle and move it to the coordinates (150,150) in the world.
_
openFrameSequencerTool|<b>openFrameSequencerTool</b>(movie)<br>
<font color=blue>movie</font>: the movie that you want to examine<br>
Opens the Frame Sequencer Tool explorer, which lets you examine and manipulate the frames of a movie.<br>
<b>Example:</b>
<pre>
def frameSequenceNewMovie():
file = pickAFile()
openFrameSequencerTool(makeMovieFromInitialFile(file))
</pre>
This opens up a file selector dialog. The user picks a picture file, and the Movie with the given file as the first frame is loaded into the Frame Sequencer Tool.
_
openPictureTool|<b>openPictureTool</b>(picture)<br>
<font color=blue>picture</font>: the picture that you want to examine<br>
Opens the Picture Tool explorer, which lets you examine the pixels of an image.<br>
<b>Example:</b>
<pre>
def openFileInPictureTool():
file = pickAFile()
pic = makePicture(file)
openPictureTool(pic)
</pre>
This opens up a file selector dialog. The user picks an image file, and it is loaded into the Picture Tool.
_
openSoundTool|<b>openSoundTool</b>(sound)<br>
<font color=blue>sound </font>: the sound that you want to examine<br>
Opens the Sound Tool explorer, which lets you examine the waveform of a sound.<br>
<b>Example:</b>
<pre>
def openFileInSoundTool():
file = pickAFile()
sound = makeSound(file)
openSoundTool(sound)
</pre>
This opens up a file selector dialog. The user picks a sound file, and it is loaded into the Sound Tool.
_
penDown|<b>penDown</b>(turtle):<br>
<font color=blue>turtle</font>: the turtle to operate on<br>
Makes it so the turtle leaves a trail when it moves. Default is down.<br>
<b>Example:</b>
<pre>
def turtleSquare():
w = makeWorld()
t = makeTurtle(w)
for x in range(0,4):
penUp(t)
forward(t)
turnRight(t)
penDown(t)
forward(t)
</pre>
This will create a turtle and draw a 200x200 square with only half of each edge showing.
_
penUp|<b>penUp</b>(turtle):<br>
<font color=blue>turtle</font>: the turtle to operate on<br>
Makes it so the turtle does not leave a trail when it moves. Default is down.<br>
<b>Example:</b>
<pre>
def turtleSquare():
w = makeWorld()
t = makeTurtle(w)
for x in range(0,4):
penUp(t)
forward(t)
turnRight(t)
penDown(t)
forward(t)
</pre>