Suppose that x='hello'. My program then asks you for an input. I want it to move on to the next line as soon as you type hello. I'm not sure how to do this without pressing enter.
Asked
Active
Viewed 369 times
1 Answers
0
Though I am not familiar with Python but here is how I would have done it in C#.
Step 1) I will add a OnKeyDown Event to the textbox in which the text is to be added.
Step 2) Every time a key is pressed, my OnKeyDown event will check whether the input matches the particular output or not, in you case, "hello".
Here is how the code will look like:-
private void OnKeyDown(object sender, EventArgs e)
{
if(textbox.Text=="hello")
textbox.Text+="\n";
}
I think the similar logic will work in Python. Try creating or using the similar Event Handler that I used in the code, ie OnKeyDown.

Mohsin Yaqoob
- 68
- 1
- 8