[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SyntaxError: positional argument follows keyword argument

On Sat, Jun 8, 2019 at 4:45 AM Rich Shepard <rshepard at> wrote:
> 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),
> )

General principle: When you see a syntax error, look *before* that
point (reading top-to-bottom, left-to-right, same as the parser does).
Often, the problem is prior to the point where it was actually

Specific point: It looks like perhaps you're trying to assign in the
middle of a function call. That doesn't do what you think it does, but
on sufficiently-recent versions of Python, you can do this with
"input_var := tk.IntVar". That might be the easiest solution.