Beispiel #1
0
def TextScroll():

    scrollText = GRC.Text(GRC.Point(500, 15),
                          "Scroll Demo.... ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    scrollText.setTextColor("Blue")
    scrollText.setFontSize(12)
    gWindow.addItem(scrollText)
    gWindow.update()

    for moveX in range(1, 700, 1):
        scrollText.move(-1, 0)
        gWindow.redraw()
        GRC.time.sleep(.01)

    Util.pause(gWindow)
Beispiel #2
0
def main():
    windowWidth = 300
    windowHeight = 300

    Color = random.choice(Colors)
    gWindow = GRC.GraphicsWindow("Polygon", windowWidth, windowHeight)
    gWindow2 = GRC.GraphicsWindow("Polygon2", windowWidth, windowHeight)

    gWindow2.setCoords(0, 0, 10, 10)
    gWindow.setCoords(0, 0, 10, 10)
    t = GRC.Text(GRC.Point(5, 5), "Centered Text")
    t.draw(gWindow2)
    p = GRC.Polygon(GRC.Point(1, 1), GRC.Point(5, 3), GRC.Point(2, 7))
    p.draw(gWindow)
    pause(gWindow)
Beispiel #3
0
def main():

    circlePoints = pointsOnCircle(150, 150, 100)
    HourHandcirclePoints = pointsOnCircle(150, 150, 90)
    minuteHandcirclePoints = pointsOnCircle(150, 150, 95)
    secondHandEndPoint = circlePoints[0]

    secondHand = GRC.Line(secondHandEndPoint, clockCenter)
    gWindow.addItem(secondHand)
    gWindow.setBackground("Black")

    for tick in range(0, 360, 6):
        gWindow.plotPixel(circlePoints[tick].getX(), circlePoints[tick].getY(),
                          "Yellow")

    while (True):

        hour, minute, sec = getCurrentTime()
        if hour == 12:
            hour = 0
        hourHandEndPoint = HourHandcirclePoints[hour * 30]
        minuteHandEndPoint = minuteHandcirclePoints[minute * 6]
        secondHandEndPoint = circlePoints[sec * 6]

        hourHand = clockHand(hourHandEndPoint, 3, "red", clockCenter)
        MinuteHand = clockHand(minuteHandEndPoint, 2, "Blue", clockCenter)
        secondHand = clockHand(secondHandEndPoint, 1, "White", clockCenter)

        hourHand.draw(gWindow)
        secondHand.draw(gWindow)
        MinuteHand.draw(gWindow)

        message = GRC.Text(
            GRC.Point(150, 290),
            str(hour).zfill(2) + ":" + str(minute).zfill(2) + ":" +
            str(sec).zfill(2))
        message.setFillColor("Green")
        message.draw(gWindow)
        GRC.time.sleep(interval)

        message.undraw()
        hourHand.undraw()
        secondHand.undraw()
        MinuteHand.undraw()
Beispiel #4
0
def demo():

    import random, os, sys, inspect, pickle
    from Library import GRCGraphics as GRC

    windowWidth = 300
    windowHeight = 25
    interval = 1
    Color = random.choice(GRC.COLORS)
    gWindow = GRC.GraphicsWindow("Text Demo", windowWidth, windowHeight)

    scrollText = GRC.Text(GRC.Point(500, 15), "Scroll Demo.... ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    scrollText.setTextColor("Blue")
    scrollText.setFontSize(12)
    gWindow.addItem(scrollText)
    gWindow.update()

    for moveX in range(1,700,1):
        scrollText.move(-1,0)
        gWindow.redraw()
        GRC.time.sleep(.01)

    Util.pause(gWindow)