How to get user input using read() widgets

The input() is a beloved Python built-in function, present at every Python 101 class and the simplest way for users to interact with your script.

It’s very straightforward to use: it demands an input from the user and turns this answer into a string, which can then be used anywhere in your code. Pretty cool.

But sometimes, a simple text input can slow you down. Validating and transforming that string into different object types can take a while.

And if you need to receive other formats from your user, like an image or a file, the input() is simply not enough.

That’s why we built the read_() widgets. From automatic email and date validations to multiple upload formats, we’re building a comprehensive library of options to suit every input need. Here are a few highlights:

  • read_number: reads an integer, replacing the need for a later int().

  • read_multiple_choice: handy to present a set of input options.
  • read_file: reads and stores any type of file input from a user.

  • read_cards: presents a set of cards for users to pick from, receives answer in a dictionary.

  • read_tag: allows for the input of multiple tags, which are kept in list.

So next time you’re coding, why stop at input()? Use our read_() widgets to take your projects to the next level :)

Check out more input widgets options on our docs.

Download Abstra to start creating your own projects.