Skip to content

Commit

Permalink
eg.popup_get_form の cancel button をローカライズ #100
Browse files Browse the repository at this point in the history
  • Loading branch information
kujirahand committed Dec 27, 2024
1 parent 6b2dc9d commit edf0a5a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions TkEasyGUI/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ def popup_buttons(
result = buttons[-1] if len(buttons) > 0 else default

# create window
eg_buttons: list[eg.Element] = [eg.Button(s, width=9) for s in buttons]
eg_buttons_pad: list[eg.Element] = [eg.Push()] + eg_buttons + [eg.Push()]
layout: eg.LayoutType = [
[eg.Text(message)],
[eg.Button(s, width=9) for s in buttons],
eg_buttons_pad,
]

# event loop
Expand Down Expand Up @@ -708,7 +710,8 @@ def popup_get_form(
# append line
layout.append(line)
layout.append([eg.HSeparator()])
layout.append([eg.Button("OK", width=9), eg.Button("Cancel", width=5)])
cancel_label = le.get_text("Cancel")
layout.append([eg.Push(), eg.Button("OK", width=9), eg.Button(cancel_label, key="Cancel", width=5), eg.Push()])
with eg.Window(title, layout=layout) as win:
result: Union[dict[str, Any], None] = None
for event, values in win.event_iter():
Expand Down

0 comments on commit edf0a5a

Please sign in to comment.