#!/usr/bin/env python3 # -*- mode: python; Encoding: utf-8; coding: utf-8 -*- # Last updated: <2025/10/30 14:31:24 +0900> """ messagebox sample. font change. Linux上ではフォント変更が反映されるが、Windows上では反映されない。 Ubuntu Linux 20.04 LTS + Python 3.8.10 """ import tkinter as tk from tkinter import messagebox TEXT = "Lorem ipsum dolor sit amet, \nconsectetur adipiscing elit, \nsed do eiusmod tempor incididunt ut labore et dolore magna aliqua." TITLE = "messagebox" def show_messagebox(): global root messagebox.showinfo(TITLE, TEXT, parent=root) root = tk.Tk() root.title("messagebox sample") root.geometry("300x200") # font setting root.option_add("*Dialog.msg.font", "Impact 24") # root.option_add("*Dialog.msg.width", 20) # root.option_add("*Dialog.msg.wrapLength", "8i") btn1 = tk.Button(root, text="Show messagebox", command=show_messagebox) btn1.pack(pady=8) root.mainloop()