Present blank screen, wait for key press -- how?

2024/10/13 23:23:28

'lo,

I am currently trying to code a simple routine for an experiment we are planning to run. The experiment starts by entering a subject number and creating a bunch of files. I got that part working. Next, we want the screen to go blank and display a message. Something like 'Please fill in questionnaire 1 and press [ENTER] when you are done.'

My question is, how do you recommend I present a blank screen with a message like that that waits for a certain key to be pressed?

I have quite some programming experience but haven't worked with Python before so any hints are greatly appreciated. Thanks a lot in advance for your time!

~~~~~~~~~~~~~~~~~~

Some extra info that might be relevant: We are running this on Windows XP (Service Pack 2) computers. The whole point of this is that the participant does not have access to the desktop or anything on the computer basically. We want the experiment to start and display a bunch of instructions on the screen that the subject has to follow without them being able to abort etc. Hope this makes sense.

Answer

If you're in python 2, use raw_input().

If you're using python 3, use input().

You can prompt the user for information and store the result as a string.

in python 2.x

response = raw_input("What would you like to do next?")

in python 3.x

response = input("What would you like to do next?")
https://en.xdnf.cn/q/118021.html

Related Q&A

Images appearing in all but 1 flask page

I am creating a web app in flask, python, mysql. When viewing every other page on my website my images load, but when viewing one specific page, I cant get any images to load using already working code…

Python: Write nested list objects to csv file

Im trying to write data from a list of lists to a csv file. This is a simplified version of what I haveclass Point(object): def __init__(self, weight, height):self.weight = weightself.height = heightde…

Entire module is not detected by __init__.py

I have a relatively small python program which is setup like thisRoot--Network--DTOLots of py files which contain classes.Other py files in the projectBoth in the Network and the DTO folder there is an…

Python output to terminal during ssh login

I have been looking everywhere for this and have not found a solution. I am using python 2.5.1 on an Apple iPod and I am trying to connect to a host with SSH. First I start off with import os. Next I o…

Unable to find SIFT or xfeatures2d in OpenCV Python [duplicate]

This question already has answers here:PyCharm: Installation of non-free OpenCV modules for operations like SIFT, SURF(2 answers)Closed 6 years ago.I recently switch back to python for facial detection…

Django paginate for django 2

I need to use pagination to a Django list but I couldnt find any help online,, only old docs from Django version 1.3 here are my files : views.pydef home(request):all_dress = Item.objects.all().filter(…

AttributeError Button object has no attribute scrlFBtn

from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.core.window import Window from kivy.uix.scrollview import ScrollView from kivy.effects.scrol…

How to set interpreter of WinPython as the vim default python interpreter?

I use a Python distribution named WinPython. Now I want my vim to use the python interpreter in WinPython as its default interpreter. I tried add the F:\WinPython\python-2.7.3.amd64 into my windows env…

how to deal with Python BaseHTTPServer killed,but the port is still be occupied?

I use python BaseHTTPServer,it can handle do_GET,do_POST methods,in do_POST method,i execute linux shell using os.system,when i kill the python script,but the listening port still occupied,so i cant ru…

Circular imports and class fields in python3

Okay, I do understand that this topic is old as hell, but I couldnt find an answer to the particular question that I am asking.Lets say that we have a very simple structure: two files, a.py and b.py, t…