A loop in a graphics window?

229 Views Asked by At

I'm working on an assignment for class. I have most of it finished I just need to get the loop at the end to show up with the Unicode codes on the graphics window. Not sure what I need to do to get it to show up. I've tried a couple iterations of what I have there at the end and can't seem to get it to work.

from graphics import *


def main():
    win = GraphWin("Unicode Window", 500, 500)
    win.setCoords(0.0, 0.0, 10.0, 10.0)


    text = Text(Point(5.0, 9.0), "This is a message coder to convert your message into Unicode.")
    text.draw(win)

    text2 = Text(Point(5.0, 8.0), "Enter your message below. Click the convert")
    text2.draw(win)

    text3 = Text(Point(5.0, 7.5), "button to see your message in Unicode.")
    text3.draw(win)

    message = Entry(Point(5.0, 6.0), 20)
    message.setText("Enter the message here")
    message.draw(win)

    button = Text(Point(5.0, 4.5), "Convert")
    button.draw(win)
    rect = Rectangle(Point(4.0, 4.0), Point(6.0, 5.0))
    rect.draw(win)

    win.getMouse()

    text4 = Text(Point(5.0, 3.0), "\nHere are the Unicode codes:")
    text4.draw(win)

    for i in message:
        unit = Text(ord(i), end =" ")
        unit.draw(win)

    print()


main()
0

There are 0 best solutions below