File: pentests.py

package info (click to toggle)
pythoncard 0.8.1-8.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 5,352 kB
  • ctags: 4,594
  • sloc: python: 42,401; makefile: 55; sh: 22
file content (64 lines) | stat: -rw-r--r-- 1,780 bytes parent folder | download | duplicates (4)
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

from wrappers import Turtle
# KEA 2004-08-08
# workaround for Mac not updating display until idle
import wx

def draw(canvas):
    # top left corner is 0,0 and bottom right is some positive x and positive y
    # so the coordinate space is not like a Logo turtle where 0,0 is the center
    # of the screen

    # these are returning the screen dimensions, not the width of the dc
    #print dc_local.GetSize()
    #print dc_local.GetSizeTuple()
    #print dc_local.GetClippingBox()

    t1 = Turtle(canvas)
    # background is shared among all turtles
    t1.setBackColor('black')
    t1.color('red')
    t1.showTurtle()
    t1.turtleDelay(1)
    t1.cls()  # get rid of any previous drawing
    
    t2 = Turtle(canvas)
    t2.color('green')
    t2.showTurtle()
    t2.width(2)
    t2.left(120)
    
    t3 = Turtle(canvas)
    t3.color('blue')
    #t3.showTurtle()
    t3.width(3)
    t3.left(240)

    t1.forward(50)
    t2.forward(50)
    t3.forward(50)
    # for loop below is equivelant, need a better way of doing
    # index range though
    nList = ['1', '2', '3']
    for i in nList:
        eval('t' + i + '.pu()')
        eval('t' + i + '.forward(50)')
        eval('t' + i + '.pd()')
    # KEA 2004-08-08
    # workaround for Mac not updating display until idle
    if wx.Platform == '__WXMAC__':
        canvas.redraw()

    tList = [t1, t2, t3]
    for i in range(6):
        [t.fd(80) for t in tList]
        # huge delay so we can see the turtle
        #for j in range(1000000): pass
        [t.rt(60) for t in tList]
        # huge delay so we can see the turtle
        #for j in range(1000000): pass
        # KEA 2004-08-08
        # workaround for Mac not updating display until idle
        if wx.Platform == '__WXMAC__':
            canvas.redraw()