Open ulno opened 5 years ago
Hi @ulno,
Calling hide_cursor()
doesn't have any effect, because show_cursor()
is probably called again at the end of the next render/paint event.
The visibility of the cursor is determined by the visibility of the currently focused user control. Every UIControl
has a method create_content()
which returns a UIContent
object. The cursor becomes visible if the show_cursor
attribute of this UIContent
is true for the current control. Right now, most built-in widgets probably don't allow you to hide the cursor, without overriding private methods.
But if you are sure you always want to hide the cursor, you could replace the Output.show_cursor()
method:
output.show_cursor = lambda:None
Hope this helps, Jonathan
That does work! Thanks @jonathanslenders.
Should that be at least documented somewhere?
Unfortunately, I was developing this terminal-app for an educational project running on the Raspberry Pi. It turns out that python prompt toolkit is totally unusable on the Raspberry Pi - 2s to react to keyboard strokes moving from button to button (it might be something with ncurses and effects ipython, xonsh, and even asciimatic too), but I will open another issue for that. This is further explained in #830.
I am building a small TUI application with python prompt toolkit, it is not using a prompt. As there is nothing to input, I would like to hide the cursor. There are just a couple of buttons in a full-screen text application.
I tried to use
application.output.hide_cursor()
beforeapplication.run()
, however that seems to be ignored. As I have no input, I can also not wrap the whole thing into a Window-object and set itsalways_hide_cursor
property to True nor access the underlyingScreen
objects which seem to have an effect if the cursor get switched on in rendering or not.Is there any way I can accomplish to disable the cursor in my case?