Tkinter - resize tkMessageBox

R

rahulnag22

Hi,
Is there a way to resize the width of the "tkMessageBox.askyesno"
dialog box, so that the text does not wrap to the next line.
Thanks
Rahul
 
J

jim-on-linux

Hi,
Is there a way to resize the width of the
"tkMessageBox.askyesno" dialog box, so that the
text does not wrap to the next line. Thanks
Rahul
I don't know of any.
It's a little more work but your better off using
Toplevel and/or frame, you have more control over
the window and its appearance.

jim-on-linux
http://www.inqvista.com
 
G

Glenn Hutchings

Is there a way to resize the width of the "tkMessageBox.askyesno"
dialog box, so that the text does not wrap to the next line.

You can use the Tk option database, either explicitly or from a file.
For example, to set the wrap length of all dialogs to 10 inches, try
this:

root = Tk()
root.option_add("*Dialog.msg.wrapLength", "10i")

Regards,

Glenn
 
C

Cameron Laird

You can use the Tk option database, either explicitly or from a file.
For example, to set the wrap length of all dialogs to 10 inches, try
this:

root = Tk()
root.option_add("*Dialog.msg.wrapLength", "10i")
.
.
.
But that does *not* affect the MessageBoxes under MacOS and Windows, right?
 
C

Cameron Laird

I don't know of any.
It's a little more work but your better off using
Toplevel and/or frame, you have more control over
the window and its appearance.
.
.
.
Yes and no. Yes, synthesizing ones own MessageBox gives greater
control, but that becomes a non-"native" MessageBox which is
alleged to discomfort some end-users.

'Nother way to say this: tkMessageBox is implemented in terms of
native widgets, as much as possible, and native MessageBoxes on
at least some platforms do NOT provide for resizing or width
control.
 
C

Cameron Laird

.
.
.
But that does *not* affect the MessageBoxes under MacOS and Windows, right?

I apologize for my coyness. I'll be explicit: current MessageBoxes
under MacOS and Windows (but NOT X11-based MessageBoxes, as with Linux)
do NOT respect Dialog options. Tkinter will presumably build in Tile
capabilities in the future; then the default appearances may change
again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top