How do you see if the window has been resized? I start in full screen, but if I change so it fits half of my screen, all my text gets mixed up.
Here is my code:
# Import os
import os
# Create function called title that prints the title screen
def title():
print('@------------------------------------------------------------------------------------@'.center(os.get_terminal_size().columns), end='')
print('| |'.center(os.get_terminal_size().columns), end='')
print('| |PyTerm v0.1.7| |'.center(os.get_terminal_size().columns), end='')
print('| |'.center(os.get_terminal_size().columns), end='')
print('@------------------------------------------------------------------------------------@'.center(os.get_terminal_size().columns), end='')
# Call the function
title()
Once I run it, the text gets aligned, but when I go into fullscreen, they get all over the place. Is there a way to fix this? Can I somehow sense when the user resizes the window? I'm on Windows 10, using Python 3.1.9. Running it with py ( C:\Windows\py.exe
)
This is what it looks like when I run it:
Here is it when I go into fullscreen:
Thanks