Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User input in dialog box

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)
like image 352
RonyA Avatar asked May 20 '18 18:05

RonyA


People also ask

How can we get input from the user in a dialog box?

The prompt() method displays a dialog box that prompts the user for input. The prompt() method returns the input value if the user clicks "OK", otherwise it returns null .

What is input dialog box?

2.6 Dialog Boxes for Input /Output A dialog box is a small graphical window that displays a message to the user or requests input. Two of the dialog boxes are: – Message Dialog - a dialog box that displays a message. Input Dialog - a dialog box that prompts the user for input.

How do you take user input in Matlab?

x = input( prompt ) displays the text in prompt and waits for the user to input a value and press the Return key. The user can enter expressions, like pi/4 or rand(3) , and can use variables in the workspace. If the user presses the Return key without entering anything, then input returns an empty matrix.

How do you input a dialog box in Python?

PyQt5 provides a class named QInputDialog which is used to take input from the user. In most of the application, there comes a situation where some data is required to be entered by the user and hence input dialog is needed. Input can be of type String or Text, Integer, Double and item.


1 Answers

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.

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?")

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

like image 63
user3133732 Ver. 2.1 Avatar answered Sep 21 '22 15:09

user3133732 Ver. 2.1