Frederik Koefoed
Frederik Koefoed

Reputation: 75

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

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.

Upvotes: 7

Views: 10959

Answers (2)

Drew Cunningham
Drew Cunningham

Reputation: 71

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

Upvotes: 6

SRT HellKitty
SRT HellKitty

Reputation: 597

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.

Upvotes: 1

Related Questions