[Tkinter-discuss] Font control in tkMessageBox?

Michael Lange klappnase at web.de
Wed Apr 13 20:25:28 CEST 2005


On Wed, 13 Apr 2005 09:38:43 -0600
Stewart Midwinter <stewart.midwinter at gmail.com> wrote:

> On 4/13/05, Michael Lange <klappnase at web.de> wrote:
> > you can specify an application-wide default font which will be used by tkMessageBox , too.
> > 
> > >>> from Tkinter import *
> > >>> import tkMessageBox
> > >>> r = Tk()
> > >>> r.option_add('*font', 'Helvetica -12')
> > >>> tkMessageBox.showinfo(message='Hello')
> 
> This seems to have no effect under WindowsXP. 

I think under windows Tk uses native OS message boxes, the original poster asked about linux.

> I forgot to include the contents of my optionsDB:
> 
> *font:              Verdana 28
> *Label*font:        Verdana 28 bold
> *background:        yellow
> *Entry*background:  white
> *Label*background:  yellow
> *foreground:        blue
> *tkMessageBox*background: yellow
> *Button*background: orange
> 
> Setting options using option_add appears to have no effect for me. 
> 
> 

I think option_add() *should* work, I don't have windows installed though, so I cannnot try it here.
I know you can use option_readfile() as well, but if you just want to change the default font
it seemed nicer to me if you don't need an extra file.
BTW, does this:

 *tkMessageBox*background: yellow

work under windows (under linux it surely does not)?

Best regards

Michael


More information about the Tkinter-discuss mailing list