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

9.1k views Asked by At

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.

2

There are 2 answers

0
SRT HellKitty On BEST ANSWER

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.

2
Drew Cunningham On

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")