Control Font in tkMessageBox

前端 未结 3 1628
失恋的感觉
失恋的感觉 2021-01-12 04:20

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,

3条回答
  •  Happy的楠姐
    2021-01-12 04:44

    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.)

提交回复
热议问题