如何在 tkinter python3.7 中更改 messagebox.showinfo(message='Hello') 中消息的字体大小

编程入门 行业动态 更新时间:2024-10-27 20:25:59
本文介绍了如何在 tkinter python3.7 中更改 messagebox.showinfo(message='Hello') 中消息的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我试图在显示某些消息时使显示的消息字体更大,以便眼睛比标准尺寸更容易阅读.我查看了过去有关此问题的帖子,但找不到任何有帮助的答案.我使用 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/t/python/tkinter-discuss/054chdx51f/font-control-in-tkmessagebox

Code i found on previous posts or link: https://grokbase/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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 06:06:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390822.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字体大小   消息   如何在   tkinter   showinfo

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!