Пример #1
0
def diagram():
    """The Involute diagram.

    This is "transliterated" from the original GW-Basic, quirks
    and all.
    """
    g= GWGraphics()
    g.SCREEN( 8 )
    g.PRINT( "INVOLUTE of a CIRCLE" )
    g.LOCATE( 3,12 ); g.PRINT( "Y" )
    g.LOCATE( 12,50 ); g.PRINT( "X" )
    g.LOCATE( 12,11 ); g.PRINT( "O" )
    g.LOCATE( 7,11 ); g.PRINT( "A" )
    g.LOCATE( 17,11 ); g.PRINT( "B" )
    S=0.42 #!                                 :REM'aspect ratio for screen 2
    R=92; H=91; PI=3.141593
    g.LINE(R,H+R*S,R,25)
    g.LINE(R,H,381,H, pattern=0x5555 )
    g.CIRCLE (R,H,R)
    I=80; L=0
    for Z in range(1,I+1): # FOR Z=1 TO I
        L=L+PI/I
        X=R*((SIN(L)-L*COS(L)))+R
        Y=H-(R*(COS(L)+L*SIN(L)))*S
        g.PSET (X,Y)
    I=10; L=0
    for Z in range(1,I+1): # FOR Z=1 TO I
        L=L+PI/I
        X=R*((SIN(L)-L*COS(L)))+R
        Y=H-(R*(COS(L)+L*SIN(L)))*S
        A=R*SIN(L); B=R*COS(L)*S
        g.LINE(R+A,H-B,X,Y, pattern=0x1111)
        if Z == 7: # IF Z<>7 THEN 500
            g.LINE(R+A,H-B,X,Y)
            g.LINE(R,H,X,Y)
            g.LINE(R+A,H-B,R,H)
            g.LOCATE( 14,21 ); g.PRINT( "E" )
            g.LOCATE( 5,37 ); g.PRINT( "C" )
            g.CIRCLE (R,H,R/2,start=1.8*PI,end=PI/2 )
            g.LOCATE (11,19); g.PRINT("phi")
            g.LOCATE (7,32); g.PRINT( "a" )
    g.LINE(R,Y,X,Y, pattern=0x5555 )
    g.LOCATE (17,50); g.PRINT( "D" )
    #530 LOCATE 19:PRINT STRING$(80,45)
    g.display( "Involute of a Circle" )
Пример #2
0
#!/Library/Frameworks/Python.framework/Versions/3.2/bin/python3.2
"""Logoclok

"CLOCK",", (screen saver)","","LOGOCLOK"
"SCREEN SAVER",", (analog clock)","","LOGOCLOK"
"""
from hamcalc.stdio.gwgraphics import GWGraphics
import math
import datetime

# 60
N = "H A M C A L C"                 #REM'logo

g= GWGraphics()
g.SCREEN( 9 )
J = "Sunday,Monday,Tuesday, Wednesday,Thursday,Friday,Saturday".split(',')
M = "Jan.,Feb.,Mar.,Apr.,May.,Jun.,Jul.,Aug.,Sep.,Oct.,Nov.,Dec.".split(',')
C = [0,0,10,11,12,13,14] # colours

SX = SY = 0 # Implied Initial Values
MX = MY = 0

ASP = 1.38                          #REM'aspect ratio correction
while True:
    CX=315;CY=104                   #REM'initial coordinates of dial centre
    LIN=8                           #REM'initial line for text
    RD=147                          #REM'length of dial radial
    RN=98                           #REM'length of 5 minute markers radial
    RS=98                           #REM'length of seconds radial
    RM=90                           #REM'length of minutes radial
    RH=60                           #REM'length of hours radial