Make button widget unicode-aware (spacing)
This commit is contained in:
parent
39e1f92970
commit
040427884b
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import urwid
|
||||
from wcwidth import wcswidth
|
||||
|
||||
|
||||
class Clickable:
|
||||
|
@ -40,12 +41,12 @@ class Button(urwid.AttrWrap):
|
|||
"""Styled button."""
|
||||
def __init__(self, *args, **kwargs):
|
||||
button = urwid.Button(*args, **kwargs)
|
||||
padding = urwid.Padding(button, width=len(args[0]) + 4)
|
||||
padding = urwid.Padding(button, width=wcswidth(args[0]) + 4)
|
||||
return super().__init__(padding, "button", "button_focused")
|
||||
|
||||
def set_label(self, *args, **kwargs):
|
||||
self.original_widget.original_widget.set_label(*args, **kwargs)
|
||||
self.original_widget.width = len(args[0]) + 4
|
||||
self.original_widget.width = wcswidth(args[0]) + 4
|
||||
|
||||
|
||||
class CheckBox(urwid.AttrWrap):
|
||||
|
|
Loading…
Reference in a new issue