控制tkMessageBox中的字体 [英] Control Font in tkMessageBox

查看:750
本文介绍了控制tkMessageBox中的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要控制tkMessageBox上的文本的字体,但我看不到任何这样的东西的参考。是否只在Tkinter中实现?



谢谢,

解决方案

可以通过执行以下操作来为对话框配置字体:

 从Tkinter导入* 
导入tkMessageBox
r = Tk()
r.option_add('* Dialog.msg.font','Helvetica 12')
tkMessageBox.showinfo(message ='Hello')

$ b

I would to like to control the font of the text on a tkMessageBox but I can't see any reference of such a stuff. Is it only implemented in Tkinter?

Thanks,

解决方案

You can configure the font for just dialog boxes by doing the following:

from Tkinter import *
import tkMessageBox
r = Tk()
r.option_add('*Dialog.msg.font', 'Helvetica 12')
tkMessageBox.showinfo(message='Hello')

(Only the option_add invocation is modified from the accepted answer.)

这篇关于控制tkMessageBox中的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆