0

我有一个用 Python3 turtle 编写的简单游戏游戏完成后我想显示消息“继续?(y/n)' 并等待用户按下键盘上的按钮。任何想法如何实现等待功能?

4

1 回答 1

0

看看textinput方法:

def textinput(self, title, prompt):
    """Pop up a dialog window for input of a string.

    Arguments: title is the title of the dialog window,
    prompt is a text mostly describing what information to input.

    Return the string input
    If the dialog is canceled, return None.

    Example (for a TurtleScreen instance named screen):
    >>> screen.textinput("NIM", "Name of first player:")

    """
    return simpledialog.askstring(title, prompt)
于 2013-03-19T23:54:22.763 回答