I've started to play around with blessings - so far I'm liking it a lot since it does make things a lot easier.
However I tried to clear the screen without success... enter_fullscreen
seems to work tho since that "clears" it - but exit_fullscreen
doesn't bring me back to the original view.
term = blessings.Terminal()
term.enter_fullscreen
with term.location():
print(term.move(0,(term.width/2)-7) + term.bold_green("Test Test Test"))
print(term.move(5,(term.width/2)-7) + term.bold_red("Test Test Test"))
time.sleep(5)
term.clear
term.exit_fullscreen
This works except for clear and exit_fullscreen
it seems. There is no error message or anything, it just doesn't seem to do anything.
Does anyone know how it works?
Edit: Neither
term.clear
nor
term.clear()
seem to work...
edit2:
I can pretty much do this and the result is the same as above. It does the coloring and placement but not clearing or anything else.
term = blessings.Terminal()
with term.location():
print(term.move(0,(term.width/2)-7) + term.bold_green("Test Test Test"))
print(term.move(5,(term.width/2)-7) + term.bold_red("Test Test Test"))
Press Esc. The Esc key, also known as the Escape key, helps you exit a mode or stop a sequence. You can find the Esc key on the top-left-corner of your keyboard. In some apps like media players or computer games, the Esc key also allows you to exit full screen mode.
To exit the standard view with the address bar, status bar, etc., always showing, press the F11 key on your keyboard to enter fullscreen. Pressing the F11 key again goes back to normal view.
However, to exit full-screen mode on Windows, you'll want to do the following. Using the F11 key on your computer's keyboard will let you both enter and exit full-screen mode in many applications. If you use a laptop, you might need to press Fn + F11 to activate this keyboard shortcut.
The quickest way to get Chrome in full-screen mode in Windows is to press F11 on the keyboard. The other way is through the Chrome menu: In the upper-right corner of Chrome, select the menu (three-dot) icon. In the Zoom section, select the square icon on the right.
Just as with all the other capabilities exposed by Blessings, you have to print
them for them to have any effect. What's happening under the covers is that your terminal emulator is "listening" for certain sequences, and then it responds by taking actions such as switching in or out of fullscreen mode. So, in your case, saying print term.enter_fullscreen
should do the trick. Let me know if you have any more problems!
As I read through your issue (facing the same one myself) I realized that I had forgotten that all the term.some_formatting()
calls returned a value that you then had to print. The clear function merely returns the appropriate escape sequences.
If you add:
print(term.clear())
when you want it cleared it should work.
Additionally, I had issues with ex_fullscreen, so I used the wrapper style call of fullscreen:
with term.fullscreen():
a_function_or_some_code()
That should return you to your previous state upon exiting the code block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With