pythonpyqt5qwizardqwizardpage

How to disable the back button for all pages of QWizard?


I want to disable all back buttons from my application. I found a solution only for the first and last page, but I can't disable it for all the pages.

self.setOption(QWizard.NoBackButtonOnStartPage)
self.setOption(QWizard.NoBackButtonOnLastPage)
                    or
self.setOption(QWizard.DisabledBackButtonOnLastPage)

Does anyone have a solution?


Solution

  • You can set a new button layout without BackButton using setButtonLayout():

    self.setButtonLayout(
        [
            QWizard.Stretch,
            QWizard.NextButton,
            QWizard.FinishButton,
            QWizard.CancelButton,
        ]
    )