Tkinter menu item underline syntax [RESOLVED]

Rich Shepard rshepard at appl-ecosys.com
Thu Jan 7 10:56:07 EST 2021


On Wed, 6 Jan 2021, Terry Reedy wrote:

> 'underline' has nothing to do with looking up the command in
> self.callbacks. It is a keyword parameter for the add_command method, and
> is handled like all other values passed by name, and as you did for the
> other arguments
>
>          file_menu.add_command(
>              label='New',
>              underline=0,
>              command=self.callbacks['file->new],
>              accelerator='Ctrl+N'
>          )
>
> Note: PEP 8 style is no spaces around '=' used for keyword  arguments. Here 
> is an example from idlelib.editor, 978.
>
>    menu.add_command(label=ulchars[i] + " " + file_name,
>                     command=callback,
>                     underline=0)

Thank you for the clarification.

Rich


More information about the Python-list mailing list