On 2021-01-06 at 10:32:58 -0800,
Rich Shepard <[email protected]> wrote:
> My application's menu has lines like this:
> file_menu.add_command(
> label = 'New',
> command = self.callbacks['file->new', underline 0],
> accelerator = 'Ctrl+N'
> )
>
> Python reports a syntax error when specifying the string index to underline;
> it rejects both a space and an equals sign (=).
I'm not a TKinter expert (nor even a current user), but that line that
begins with whitespace and "command =" looks suspicious. As far as I
can see, Python is correct to call it syntactically erroneous.
What is self.callbacks? Is it a function, a list of functions, a list
of something else?
Did you possibly mean to use parentheses "(" and ")" instead of brackets
"[" and "]"? Or perhaps some different punctuation between the "[" and
the "]"?
>From what I remember about TKinter, embedding Tcl/TK code inside strings
inside Python can be tricky (to say the least).
Sorry I don't have a concrete solution, just more to think about.
--
https://mail.python.org/mailman/listinfo/python-list