Change Font and Size of a Tkinter Messagebox

244 views Asked by At

i have a small Question and i finding no answer in the internet. I want to change the font and fontsize of all Tkinter Messageboxes. Maybe it would be possible if i change something in the libary but i dont now how.

Maybe somebody have an idea.

There is no option but maybe it would be posibble to change the libary to edit the size ...

1

There are 1 answers

3
ajitesh On

You can define a custom style and from their change the font option, this is a sample code to change it:

import tkinter as tk
from tkinter import messagebox

root = tk.Tk()

# Define custom style
style = tk.ttk.Style()
style.configure("CustomMessageBox.TLabel", font=("Arial", 14))

# Show messagebox with custom style
messagebox.showinfo(title="Title", message="Message", icon="info", parent=root, style="CustomMessageBox")

root.mainloop()