How do i resize the pop-up from simpledialog.askstring in tkinter?
Asked Answered
W

2

7

While using the simplesialog.askstring is good and all, I would like to resize the pop-up window and also resize the width of the text input.

(sample code)

from tkinter import *
from tkinter import simpledialog

prompts = ["name", "age", "height", "wheight"]

root = Tk()

for p in prompts:
    answer = simpledialog.askstring(p, root)
    print(answer)

I have looked at different documentation, but could not seem to spot how to do it.

With answered 27/11, 2018 at 15:47 Comment(0)
O
1

Possible Copy of Increase tkSimpleDialog window size?

My understanding is that tkinter.simpledialog is a very simple and easy-to-use dialog box with very few options(basically title and prompt).

No answer here is going to look as 'clean' as your code, unless you modify the tkinter module.(unless you get away from tkinter)

I would recommend either simply using the given simpledialog one, or trying something like the easygui enterbox for a different look, or making a simple GUI with tkinter.

Oaten answered 27/11, 2018 at 16:19 Comment(0)
A
6

If you just want to make the dialog window wider, then add extra tabs at the end of your prompt string.

For example: table_name = tk.simpledialog.askstring("Create Table", "Enter a name for the new table.\t\t\t")

Alit answered 30/9, 2021 at 17:24 Comment(2)
I don't know tkinter, but this sounds like a terrible hack.Smilacaceous
@Smilacaceous It's a hack, but it works and is much simpler than alternatives. In fact, it is more portable than setting dialog window size in pixels.Gaona
O
1

Possible Copy of Increase tkSimpleDialog window size?

My understanding is that tkinter.simpledialog is a very simple and easy-to-use dialog box with very few options(basically title and prompt).

No answer here is going to look as 'clean' as your code, unless you modify the tkinter module.(unless you get away from tkinter)

I would recommend either simply using the given simpledialog one, or trying something like the easygui enterbox for a different look, or making a simple GUI with tkinter.

Oaten answered 27/11, 2018 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.