如何在 tkinter python3.7 中更改 messagebox.showinfo(message='Hello') 中消息的字体大小 [英] how to change font size of messages inside messagebox.showinfo(message='Hello') in tkinter python3.7

查看:157
本文介绍了如何在 tkinter python3.7 中更改 messagebox.showinfo(message='Hello') 中消息的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在显示某些消息时使显示的消息字体更大,以便眼睛比标准尺寸更容易阅读.我查看了过去有关此问题的帖子,但找不到任何有帮助的答案.我使用 r.option_add 找到了答案,但它似乎对 Windows 没有任何影响.如果有人解决了这个问题并有解决这个问题的建议/答案,我将感谢所有投入时间和精力的人.谢谢.

I am trying to make displayed message fonts bigger for certain messages when it get displayed so that its easier for eyes to read than standard size. I checked on past post regarding this issue and couldn't found any answers that helps. I found answer using r.option_add but it seems not to have any effect on windows. If any one has gone through this issue and have suggestion/answer to fix this problem i would be thankful to everyone who put their time and effort on it. Thank you.

我在以前的帖子或链接中找到的代码:https://grokbase.com/t/python/tkinter-discuss/054chdx51f/font-control-in-tkmessagebox

Code i found on previous posts or link: https://grokbase.com/t/python/tkinter-discuss/054chdx51f/font-control-in-tkmessagebox

从 tkinter 导入 *

from tkinter import *

从 tkinter 导入消息框

from tkinter import messagebox

r = Tk()

r.option_add('*font', 'Helvetica-18')

r.option_add('*font', 'Helvetica-18')

messagebox.showinfo(message='Hello')

messagebox.showinfo(message='Hello')

推荐答案

Tcler 的wiki 它说:在最近的版本中,Windows messageBox 是本机"...",据我所知,这意味着它使用的是 Windows 组件,并且您无法更改消息框字体.

In the Tcler's wiki it says: "With recent versions, the Windows messageBox is "native"...", which as far as I can tell means it's using a windows component and you can't change the mesage box font.

您可以尝试在 tkinters simpledialog 的帮助下制作自己的自定义对话框.看看 effbot: Dialog Windows

You could try to make your own custom dialog with the help of tkinters simpledialog. Have a look at effbot: Dialog Windows

这篇关于如何在 tkinter python3.7 中更改 messagebox.showinfo(message='Hello') 中消息的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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