Цикл в графическом окне? - PullRequest
0 голосов
/ 11 ноября 2018

Я работаю над заданием для класса. У меня большая часть закончена, мне просто нужно получить цикл в конце, чтобы он отображался с кодами Unicode в графическом окне. Не уверен, что мне нужно сделать, чтобы это появилось. Я попробовал пару итераций того, что у меня есть в конце, и не могу заставить его работать.

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()
...