textinput() 在 python 2.x 中等效 [英] textinput() equivalent in python 2.x

查看:53
本文介绍了textinput() 在 python 2.x 中等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 python 的海龟中接受用户的信息.然而,turtle.textinput 函数仅适用于 3.x 及以上版本,我可以在 2.X 版本中使用吗?

I need to accept info from the user in python's turtle. however the turtle.textinput function only works in versions 3.x and upwards is there an alternative I can use in version 2.X ?

推荐答案

textinput 实际上是这样做的:

import tkSimpleDialog
tkSimpleDialog.askstring('title', 'prompt')

当然,它需要你打开一个海龟屏幕.

It requires you to have a turtle screen open, of course.

这篇关于textinput() 在 python 2.x 中等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆