用户在对话框中输入

编程入门 行业动态 更新时间:2024-10-28 11:29:08
本文介绍了用户在对话框中输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 07:35:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1391234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框中输入   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!