Forum > Packages and Libraries

Preventing Application Freeze During User Input in Lazarus Python Script


I have a Python script that asks for user input:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---confirmation = input("Enter confirmation (Y/S")
In a program written with the Lazarus IDE I inserted the TPythonEngine and TPythonGUIInputOutput components from the PythonForLazarus component library.

TPythonEngine.IO is pointing to TPythonGUIInput and this in turn has TPythonGUIInput.Output pointing to a Memo. When I run the Python script using TPythonEngine.ExecStrings(TListStrings), in the user input part, the Lazarus InputQuery is displayed for the user to enter the option but the application is frozen waiting for the user input, that is, the InputQuery (box ) freezes the application until the user enters the value. How do I ensure that the user can continue using the application window before entering data into InputQuery?

See if python has some event that you can plug while it is waiting for input and call application.processmessages in it.

Could you be a little more specific please? I'm new with lazarus and python. I would be happy if you could show an example.   :D

I don't know python, but lazarus must run its mainloop.  (which is what application.processmessages does).

If python can run code while it is waiting for input, you must run that.

Is it possible to change the default InputQuery at runtime? When the inputquery is called, does it execute another form instead?


[0] Message Index

Go to full version