Restoring Tix menus to system defaults

Edward K. Ream edreamleo at charter.net
Thu Nov 25 05:23:47 EST 2004


Tix appears to ruin the highlighting of menu items by default, at least with 
Python 2.3.4 on XP.  That is, changing

root = Tkinter.Tk()

to

root = Tix.Tk()

causes the app not to honor the system default way of highlighting menu 
items.  BTW, I am aware of the discussion in WmDefault.txt.

One can set highlighting by hand as follows:

try:
  import WmDefault
  WmDefault.setup(root)
  WmDefault.addoptions(root,{'activebackground':'DarkBlue','activeforeground':'white'})
except ImportError: [snip]

Alas, this suffers two big problems:

1.  WmDefault will not be on the user's path by default; the import may 
fail.
2.  The code above doesn't restore the system default.

Can someone suggest a better solution?  In particular,

1.  Is there a workaround not using WmDefault?

2.  Are there settings for 'activebackground' and 'activeforeground' that 
restore the system defaults?  Using '' as the color does not work.

Thanks very much.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edreamleo at charter.net
Leo: Literate Editor with Outlines
Leo: http://webpages.charter.net/edreamleo/front.html
-------------------------------------------------------------------- 





More information about the Python-list mailing list