用户在对话框中输入 [英] User input in dialog box

查看:43
本文介绍了用户在对话框中输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python 中是否有任何库可用于图形用户输入输入.我知道 tk 但我相信需要一些代码才能做到这一点.我正在寻找最短的解决方案.

Is there any library available in python for the graphical user entry input. I know about tk but I believe it takes some line of codes to do that. I am looking for the shortest solution.

a = input('Enter your string here:') 

取而代之的是,我想要一个对话框,以便用户可以在那里输入.

In place of this, I want to get a dialogue box so that user can input there.

这没有达到目的.这仅显示对话框,您不能提供输入条目.

This did not serve the purpose. This only shows the dialogue box and you can't provide an input entry.

import ctypes  # An included library with Python install.   
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)

推荐答案

您有两种解决方案选择.你可以通过pip获取两个包,一个是easygui,另一个是easygui_qt.easygui基于tcl,easygui_qt基于qt窗口管理器,设置起来稍微困难一点,但使用起来也一样简单,有更多的选项.

You have two choices for a solution. There are two packages you can pip to get, one is easygui, the other is easygui_qt. easygui is based on tcl, and easygui_qt is based on the qt Window manager and is a little more difficult to set up, but just as simple to use, with a few more options.

他们需要使用的只是导入包,import easygui,然后,要获得用户响应,您将使用一行...

All they require to use is to import the package, import easygui, and after that, to get a user response you would use one line...

myvar = easygui.enterbox("What, is your favorite color?")

谷歌python easygui"了解更多详细信息.
您可以从 pypi 获取 easygui.

Google "python easygui" for more detailed info.
You can get easygui from pypi.

这篇关于用户在对话框中输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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