How to change tkinter GUI look-and-feel?

  • Thread starter Jonathon McKitrick
  • Start date
J

Jonathon McKitrick

I saw some screenshots of mayavi. Is there any way we can set tkinter to
use the motif (or some other toolkit under Unix) rather than the default?

jm
 
E

Eric Brunel

Jonathon said:
I saw some screenshots of mayavi. Is there any way we can set tkinter to
use the motif (or some other toolkit under Unix) rather than the default?

jm

Motif *is* the default look for tk/Tkinter on Unix. I also saw some screenshots
of Mayavi, and I also noticed the NextStep look they had for their tk widgets. I
don't exactly know how they did that; I know there is a very old branch of tk
named tkstep that had this look, but it has been unsupported for years. Or maybe
they hacked the current Tkinter to support the new "tile" package for tk which
allows to apply themes to tk widgets? Maybe one of the MayaVi people would like
to enlighten us?

Anyway, downloading Mayavi sources and using your own Tkinter should not show
this look for the widgets, but the more "standard" Motif look.

HTH
 
K

klappnase

Jonathon McKitrick said:
I saw some screenshots of mayavi. Is there any way we can set tkinter to
use the motif (or some other toolkit under Unix) rather than the default?

jm

Hi Jonathon,

you cannot make Tkinter use another toolkit (of course); if you mean
just to change the look and feel you can use the tk_strictMotif()
method to get a quite "native" motif look and feel:

from Tkinter import *
root = Tk()
root.tk_strictMotif()

or use an optionDB file if you just want to do an application wide
change of tk's sometimes ugly defaults on unix:

from Tkinter import *
root = Tk()
root.option_readfile(path-to-your-optionDB)

The contents of the optionDB may look like this:
########-file optionDB-##############################
*font : Helvetica -12
*Entry*background : white
*Listbox*background : white
*Listbox*exportSelection : 0
*selectBackground : #a0a
*selectForeground : white
*Scrollbar*Width : 12
*Scrollbar*troughColor : #aaa
*Scrollbar*takeFocus : 0
*Checkbutton*selectColor : green
*Radiobutton*selectColor : green
*Menu*tearOff : 0
*Menu*relief : ridge
*Menu*borderWidth : 2
*Button*Width : 10
######################################################
That's an optionDB I've been using, I think you'll see the point how
to change the default values of configuration options for different
widgets.

I hope this helps

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top