Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear and exit_fullscreen seem not to work

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"))
like image 323
Jrc Avatar asked Apr 22 '13 20:04

Jrc


People also ask

Why can't I exit full screen mode?

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.

How do I get my full screen back to normal?

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.

How do I force exit full screen?

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.

Why won't my Google Chrome go full screen?

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.


2 Answers

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!

like image 166
Erik Rose Avatar answered Oct 08 '22 03:10

Erik Rose


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.

like image 25
freshvolk Avatar answered Oct 08 '22 02:10

freshvolk