Tkinter menu item underline syntax [RESOLVED]

Grant Edwards grant.b.edwards at gmail.com
Wed Jan 6 16:03:58 EST 2021


On 2021-01-06, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Wed, 6 Jan 2021, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
>
>> For the sake of future generations who may run into this issue, can you
>> post the complete, correct call to file_menu.add_command?
>
> This is the working version of the stanza I initially posted:
>
>  	file_menu.add_command(
>              label = 'New',
>              command = self.callbacks['file->new', underline: 0],
>              accelerator = 'Ctrl+N'
>          )

I'm completely baffled by that. Can somebody explain how this
expression is evaluated?

   self.callbacks['file->new', underline: 0]

It appears that the dict callbacks is being accessed with the key of 
a tuple comprising a string and a slice.

Huh?



More information about the Python-list mailing list