minerz029 minerz029 - 1 year ago 352
Python Question

How to set font of a messagebox with Python tkinter?

I'm using the simple message-boxes provided in

and I'm wondering if there's any way to change the font.

This is the general idea of what I want, but the
option doesn't work.

from tkinter import Tk
import tkinter.messagebox as tkmsg

_root = Tk()
"Some monospaced text",
font=("Monospace", 15)

Is there any way to change the font or do I have to use a custom dialog?

Answer Source

you can't. write your own messagebox using the toplevel widgted (tkinter.Toplevel()) and label!

Something like this (from http://effbot.org/tkinterbook/label.htm)

from Tkinter import *

master = Tk()

w = Label(master, text="Hello, world!")


i hope it helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download