refined dropdown word spacing for linux

This commit is contained in:
tschiman 2022-06-16 16:55:17 +02:00
parent 7a99aa318c
commit 3b259e4d01

View File

@ -70,10 +70,16 @@ class DropdownMenu(tkinter.Menu):
font=self.apply_font_scaling(self.text_font)) font=self.apply_font_scaling(self.text_font))
def add_menu_commands(self): def add_menu_commands(self):
for value in self.values: if sys.platform.startswith("linux"):
self.add_command(label=value.ljust(self.min_character_width), for value in self.values:
command=lambda v=value: self.button_callback(v), self.add_command(label=" " + value.ljust(self.min_character_width) + " ",
compound="left") command=lambda v=value: self.button_callback(v),
compound="left")
else:
for value in self.values:
self.add_command(label=value.ljust(self.min_character_width),
command=lambda v=value: self.button_callback(v),
compound="left")
def open(self, x: Union[int, float], y: Union[int, float]): def open(self, x: Union[int, float], y: Union[int, float]):
if sys.platform == "darwin": if sys.platform == "darwin":