Does one have to use curses to read single characters from keyboard?

Chris Nyland menyland at gmail.com
Sun Dec 11 12:34:25 EST 2022


You should try the input function. I use it all the time. It does require
the user to hit enter but that is pretty typical of that kind of interface.
So I would write a loop like

while True:
   answer = input("Please answer the question (y/n):")
  if answer == 'y':
    break

Chris

On Sun, Dec 11, 2022 at 11:03 AM Stefan Ram <ram at zedat.fu-berlin.de> wrote:

> ram at zedat.fu-berlin.de (Stefan Ram) writes:
> >import tkinter
>
>   This two-liner allows to answer with just one keypress ([Y]/[N]) here.
>
> import tkinter.messagebox
> tkinter.messagebox.askyesno( "Question", "Format harddisk?" )
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list