Пример #1
0
def main():
    windowWidth = 300
    windowHeight = 300

    Color = random.choice(Colors)
    gWindow = GRC.GraphicsWindow("Box", windowWidth, windowHeight)
    interval = .25
    #gWindow.setCoords(0, 0, 100, 100)
    # text = GRC.Text(GRC.Point(150, 50), "Centered Text")
    # text.setTextColor("Blue")
    # text.setSize(5)
    # gWindow.addItem(text)
    # for fontSize in range(5,25):
    #     text.setSize(fontSize)
    #     gWindow.redraw()
    #     GRC.time.sleep(interval)
    #
    # for fontSize in range(25, 8):
    #     text.setSize(fontSize)
    #     gWindow.redraw()
    #     GRC.time.sleep(interval)

    polygon1 = GRC.Polygon(GRC.Point(10, 10), GRC.Point(125, 10),
                           GRC.Point(125, 125), GRC.Point(10, 125))
    polygon1.draw(gWindow)
    Util.pause(gWindow)
Пример #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)
Пример #3
0
def drawBox():

    # set boarder Color of box object
    boarderColor = "Black"

    # set boarder Color of box object
    fillColor = "Yellow"

    # define a polygon object as a box
    polygon = GRC.Polygon(GRC.Point(10, 10), GRC.Point(125, 10),
                          GRC.Point(125, 125), GRC.Point(10, 125))
    polygon.setBoarderColor(boarderColor)
    polygon.setFillColor(fillColor)

    # Pass graphic window object to the box object; call draw method.
    polygon.draw(gWindow)
Пример #4
0
def main():

    # define size of graphics windows
    windowWidth = 300
    windowHeight = 300


    # Define the graphics window.
    gWindow = GRC.GraphicsWindow("Title of window: Box", windowWidth, windowHeight)

    # set boarder Color of box
    Color = "Black"

    #define a polygon as a box
    polygon = GRC.Polygon(GRC.Point(10, 10), GRC.Point(125, 10), GRC.Point(125,125), GRC.Point(10,125))

    #display box object on graphics windows
    polygon.draw(gWindow)

    #click to close window
    gWindow.waitForClick()