aegirhall / console-menu

A simple Python menu system for building terminal user interfaces.
MIT License
370 stars 58 forks source link

Menu border #39

Open marianlukac opened 4 years ago

marianlukac commented 4 years ago

By using the colored text, the menu border is corrupted... (see the attachment)

There is a possibility to "switch off" the menu border?

image

aegirhall commented 4 years ago

Currently there isn't a feature to disable the borders entirely. But I'll add that as a feature enhancement.

In the meantime, you can do this as a work-around:

  1. Add a new class that extends MenuBorder, for example:
class EmptyBorderStyle(MenuBorderStyle):
    @property
    def bottom_left_corner(self): return ''

    @property
    def bottom_right_corner(self): return ''

    @property
    def inner_horizontal(self): return ''

    @property
    def inner_vertical(self): return ''

    @property
    def intersection(self): return ''

    @property
    def outer_horizontal(self): return ''

    @property
    def outer_horizontal_inner_down(self): return ''

    @property
    def outer_horizontal_inner_up(self): return ''

    @property
    def outer_vertical(self): return ''

    @property
    def outer_vertical_inner_left(self): return ''

    @property
    def outer_vertical_inner_right(self): return ''

    @property
    def top_left_corner(self): return ''

    @property
    def top_right_corner(self): return ''
  1. Use your new class to set the border type in the menu formatter. For example:
# use EmptyBorderType to "disable" borders until a proper enhancement is added to console-menu
menu_format = MenuFormatBuilder().set_border_style(EmptyBorderStyle())
menu = ConsoleMenu("My Menu", formatter=menu_format)
...
SuppliedOrange commented 10 months ago

Are you using pyinstaller here? It breaks the borders for me too. There's a pull request that makes an empty border like the one mentioned above here: https://github.com/aegirhall/console-menu/pull/97