SyntaxError: positional argument follows keyword argument

Rich Shepard rshepard at appl-ecosys.com
Fri Jun 7 14:43:48 EDT 2019


I understand positional and keyword arguments and the syntax for the
ttk.Checkbutton as described on
<https://www.tcl.tk/man/tcl/TkCmd/ttk_checkbutton.htm>.

$ python3 geochem.py
   File "geochem.py", line 60
     ttk.Checkbutton(text='Censored?', variable=input_var),
     ^
SyntaxError: positional argument follows keyword argument

I've provided only keyword arguments to the call to the ttk.Checkbutton
widget and am not seeing the positional argument that follows. Please show
me what I miss seeing here:

self.inputs['nondetect'] = LabelInput(
             self, 'Censored?',
             #input_var = tk.BooleanVar(),
             input_var = tk.IntVar,
             ttk.Checkbutton(text='Censored?', variable=input_var),
)

It does not matter if the variable holding the checkbutton's state is an
IntVar or a BooleanVar, the same syntax error is generated. Commenting out
all widgets prior to this one makes no difference so the error must be
local. Yes?

Please explain where the positional argument is located.

Regards,

Rich



More information about the Python-list mailing list