Tkinter: radiobutton

Michael P. Reilly arcege at shore.net
Fri Jun 25 07:53:43 EDT 1999


kiki <kiki at pixar.com> wrote:
: "Michael P. Reilly" wrote:

:>
:> No, it's not an obvious question at all.  Unfortunately, you need to
:> track the index when you create the menu.  By default, the first call
:> starts at 1, because the "tear-off" is 0.  If the menu is created with
:> the -tearoff=0 option, then the index starts at 0
:>

: Bleh.  Oh well.  Kind of a shame, since I'd rather just have the color value
: put into the color variable, not an index with my own list I have to maintain
: myself.

: Well, cool, at least I have a solution.

: Thanx so much for your help!

Kiki,

I just uploaded a module I made for another project (and never remembered
to give to Guido).

The URL is ftp://starship.python.net/pub/crew/arcege/modules/MenuEntry.py.

In that module, you get five usable classes (and one super class):
MenuCascade, MenuCommand, MenuCheckbutton, MenuRadiobutton, MenuSeparator.

You get the following methods:
  item.activate()
  item.cget(option)
  item.configure([cnf={...},] [key=value,]...)
  item.config  - same as configure
  item.invoke()
  item.yposition()

These map to methods in the Menu class, but the MenuEntry object knows
which index it is.

  -Arcege





More information about the Python-list mailing list