The problem is that you're assigning the result of the grid
function to n
, rather than the Notebook
widget itself. The grid
function always returns None
, so n
has a value of None
, thus the error.
To fix this, try replacing this line
n = ttk.Notebook(gui).grid()
with these lines
n = ttk.Notebook(gui)
n.grid()