SyntaxError: positional argument follows keyword argument

Terry Reedy tjreedy at udel.edu
Fri Jun 7 17:00:17 EDT 2019


On 6/7/2019 2:43 PM, Rich Shepard wrote:
> 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,

An additional error is the missing ()s.  This would make input_var refer 
to the class, not an instance thereof.

>              ttk.Checkbutton(text='Censored?', variable=input_var),
> )

-- 
Terry Jan Reedy





More information about the Python-list mailing list