From edf0a5a45d94a83259e9fc598ea52bcf1b7cdbf6 Mon Sep 17 00:00:00 2001 From: kujirahand Date: Fri, 27 Dec 2024 22:37:50 +0900 Subject: [PATCH] =?UTF-8?q?eg.popup=5Fget=5Fform=20=E3=81=AE=20cancel=20bu?= =?UTF-8?q?tton=20=E3=82=92=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=82=BA=20#100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TkEasyGUI/dialogs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TkEasyGUI/dialogs.py b/TkEasyGUI/dialogs.py index 22f6847..72221b3 100644 --- a/TkEasyGUI/dialogs.py +++ b/TkEasyGUI/dialogs.py @@ -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 @@ -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():