Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UP_DOWN = chr(9474) # Character 9474 is '│'
- LEFT_RIGHT = chr(9472) # Character 9472 is '─'
- DOWN_RIGHT = chr(9484) # Character 9484 is '┌'
- DOWN_LEFT = chr(9488) # Character 9488 is '┐'
- UP_RIGHT = chr(9492) # Character 9492 is '└'
- UP_LEFT = chr(9496) # Character 9496 is '┘'
- def box_message(width, height, message):
- # Print top line:
- print(DOWN_RIGHT + (LEFT_RIGHT * (width - 2)) + DOWN_LEFT)
- for i in range(height - 2):
- if i == height // 2 - 1:
- # Print message:
- print(UP_DOWN + message.center(width - 2) + UP_DOWN)
- else:
- # Print empty line:
- print(UP_DOWN + (' ' * (width - 2)) + UP_DOWN)
- # Print bottom line:
- print(UP_RIGHT + (LEFT_RIGHT * (width - 2)) + UP_LEFT)
- box_message(50, 5, 'Do not ignore this message!')
- box_message(50, 3, 'It is very important!')
- """
- Prints out:
- ┌────────────────────────────────────────────────┐
- │ │
- │ Do not ignore this message! │
- │ │
- └────────────────────────────────────────────────┘
- ┌────────────────────────────────────────────────┐
- │ It is very important! │
- └────────────────────────────────────────────────┘
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement