Open Hirikava opened 1 year ago
Remember, this runs every frame - so when you define text_val on line 1, you're actually re-defining it every frame. You should only set text_val once, since after that it needs to hold whatever value the user inputs.
Alternatively, you can use input_text_with_hint to show a hint like that easily
I tried this simple example of input_text with pyimgui + GLFW. It works fine untill text bar losing focus and value of input resets to default one. text_val = 'Please, type the coefficient here.' imgui.begin("Example: text input") changed, text_val = imgui.input_text('Coefficient:', text_val) imgui.text('You wrote:') imgui.same_line() imgui.text(text_val) imgui.end()