The error comes up even if i pass to the ButtonMatrix constructor a frame instead of the mainwindow...