**************** wx.wizard.Wizard **************** Inheritance diagram for `wx.wizard.Wizard`: | .. inheritance-diagram:: wx.wizard.Wizard | Description =========== `wx.wizard.Wizard` is the central class for implementing 'wizard-like' dialogs. These dialogs are mostly familiar to Windows users and are nothing other than a sequence of 'pages', each displayed inside a dialog which has the buttons to navigate to the next (and previous) pages. The wizards are typically used to decompose a complex dialog into several simple steps and are mainly useful to the novice users, hence it is important to keep them as simple as possible. To show a wizard dialog, you must first create an instance of the `wx.wizard.Wizard` class using either the non-default constructor or a default one followed by call to the `Create <#Create>`_ function. Then you should add all pages you want the wizard to show and call `RunWizard <#RunWizard>`_. Finally, don't forget to call `wizard.Destroy()`, otherwise your application will hang on exit due to an undestroyed window. .. seealso:: `wx.wizard.WizardEvent <../Events/wx.wizard.WizardEvent.html>`_, `wx.wizard.WizardPage `_ Derived From ^^^^^^^^^^^^^ * `wx.Dialog <../Widgets/wx.Dialog.html>`_ * `wx.Panel <../Widgets/wx.Panel.html>`_ * `wx.Window <../Widgets/wx.Window.html>`_ * `wx.EvtHandler <../Widgets/wx.EvtHandler.html>`_ * `wx.Object <../Widgets/wx.Object.html>`_ Event Handling ^^^^^^^^^^^^^^ To process input from a wizard dialog, use these event handler macros to direct input to member functions that take a `wx.wizard.WizardEvent <../Events/wx.wizard.WizardEvent.html>`_ argument. For some events, `Veto()` can be called to prevent the event from happening. ================================================== ================================================== Event Name Description ================================================== ================================================== wx.wizard.EVT_WIZARD_PAGE_CHANGED(id, func) The page has just been changed (this event cannot be vetoed). wx.wizard.EVT_WIZARD_PAGE_CHANGING(id, func) The page is being changed (this event can be vetoed). wx.wizard.EVT_WIZARD_CANCEL(id, func) The user attempted to cancel the wizard (this event may also be vetoed). wx.wizard.EVT_WIZARD_HELP(id, func) The wizard help button was pressed. wx.wizard.EVT_WIZARD_FINISHED(id, func) The wizard finished button was pressed. ================================================== ================================================== Extra Window Styles ^^^^^^^^^^^^^^^^^^^ Use the `wx.Window.SetExtraStyle <../Widgets/wx.Window.html#SetExtraStyle>`_ function to set the following style. You will need to use two-step construction (use the default constructor, call `SetExtraStyle`, then call `Create <#Create>`_). ================================================== ================================================== Window Extra Style Description ================================================== ================================================== ``wx.wizard.WIZARD_EX_HELPBUTTON`` Shows a Help button using ``wx.ID_HELP``. ================================================== ================================================== .. seealso:: `wx.Dialog <../Widgets/wx.Dialog.html>`_ for other extended styles. Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Create <#Create>`_ * `FitToPage <#FitToPage>`_ * `GetBitmap <#GetBitmap>`_ * `GetCurrentPage <#GetCurrentPage>`_ * `GetPageAreaSizer <#GetPageAreaSizer>`_ * `GetPageSize <#GetPageSize>`_ * `HasNextPage <#HasNextPage>`_ * `HasPrevPage <#HasPrevPage>`_ * `Init <#Init>`_ * `IsRunning <#IsRunning>`_ * `RunWizard <#RunWizard>`_ * `SetBitmap <#SetBitmap>`_ * `SetBorder <#SetBorder>`_ * `SetPageSize <#SetPageSize>`_ * `ShowPage <#ShowPage>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Bitmap <#Bitmap>`_ * `CurrentPage <#CurrentPage>`_ * `PageAreaSizer <#PageAreaSizer>`_ * `PageSize <#PageSize>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=-1, title="", bitmap=wx.NullBitmap, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE) Constructor which really creates the wizard -- if you use this constructor, you shouldn't call `Create <#Create>`_. Notice that unlike almost all other wxPython classes, there is no `size` parameter in the `wx.wizard.Wizard` constructor because the wizard will have a predefined default size by default. If you want to change this, you should use the `GetPageAreaSizer <#GetPageAreaSizer>`_ method. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_): The parent window, may be ``None``. * `id` (int): The id of the dialog, will usually be just -1. * `title` (string): The title of the dialog. * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_): The default bitmap used in the left side of the wizard. See also `GetBitmap <#GetBitmap>`_. * `pos` (`wx.Point <../Widgets/wx.Point.html>`_): The position of the dialog, it will be centered on the screen by default. * `style` (long): Window style is passed to `wx.Dialog <../Widgets/wx.Dialog.html>`_. | **Returns:** `wx.wizard.Wizard `_ -------- .. method:: Create(parent, id=-1, title="", bitmap=wx.NullBitmap, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE) Creates the wizard dialog. Notice that unlike almost all other wxPython classes, there is no `size` parameter in the `wx.wizard.Wizard` constructor because the wizard will have a predefined default size by default. If you want to change this, you should use the `GetPageAreaSizer <#GetPageAreaSizer>`_ method. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_): The parent window, may be ``None``. * `id` (int): The id of the dialog, will usually be just -1. * `title` (string): The title of the dialog. * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_): The default bitmap used in the left side of the wizard. See also `GetBitmap <#GetBitmap>`_. * `pos` (`wx.Point <../Widgets/wx.Point.html>`_): The position of the dialog, it will be centered on the screen by default. * `style` (long): Window style is passed to `wx.Dialog <../Widgets/wx.Dialog.html>`_. | **Returns:** `bool` -------- .. method:: FitToPage(firstPage) Sets the page size to be big enough for all the pages accessible via the given `firstPage`, i.e. this page, its next page and so on. This method may be called more than once and it will only change the page size if the size required by the new page is bigger than the previously set one. This is useful if the decision about which pages to show is taken during run-time, as in this case, the wizard won't be able to get to all pages starting from a single one and you should call `Fit` separately for the others. **Parameters:** * `firstPage` (`wx.wizard.WizardPage `_) .. warning:: This method is obsolete, use `GetPageAreaSizer <#GetPageAreaSizer>`_ instead. -------- .. method:: GetBitmap() Returns the bitmap used for the wizard. | **Returns:** `wx.Bitmap <../Widgets/wx.Bitmap.html>`_ -------- .. method:: GetCurrentPage() Get the current page while the wizard is running. ``None`` is returned if `RunWizard <#RunWizard>`_ is not being executed now. | **Returns:** `wx.wizard.WizardPage `_ -------- .. method:: GetPageAreaSizer() Returns pointer to page area sizer. The wizard is laid out using sizers and the page area sizer is the place-holder for the pages. All pages are resized before being shown to match the wizard page area. Page area sizer has a minimal size that is the maximum of several values. First, all pages (or other objects) added to the sizer. Second, all pages reachable by repeatedly applying `wx.wizard.WizardPage.GetNext `_ to any page inserted into the sizer. Third, the minimal size specified using `SetPageSize <#SetPageSize>`_ and `FitToPage <#FitToPage>`_. Fourth, the total wizard height may be increased to accommodate the bitmap height. Fifth and finally, wizards are never smaller than some built-in minimal size to avoid wizards that are too small. The caller can use `wx.Sizer.SetMinSize <../Widgets/wx.Sizer.html#SetMinSize>`_ to enlarge it beyond the minimal size. If ``wx.RESIZE_BORDER`` was passed to constructor, user can resize wizard and consequently the page area (but not make it smaller than the minimal size). It is recommended to add the first page to the page area sizer. For simple wizards, this will enlarge the wizard to fit the biggest page. For non-linear wizards, the first page of every separate chain should be added. Caller-specified size can be accomplished using `wx.Sizer.SetMinSize <../Widgets/wx.Sizer.html#SetMinSize>`_. Adding pages to the page area sizer affects the default border width around page area that can be altered with `SetBorder <#SetBorder>`_. | **Returns:** `wx.Sizer <../Widgets/wx.Sizer.html>`_ -------- .. method:: GetPageSize() Returns the size available for the pages. | **Returns:** `wx.Size <../Widgets/wx.Size.html>`_ -------- .. method:: HasNextPage(page) Return ``True`` if this page is not the last one in the wizard. The base class version implements this by calling `page.GetNext()` but this could be undesirable if, for example, the pages are created on demand only. **Parameters:** * `page` (`wx.wizard.WizardPage `_) | **Returns:** `bool` .. seealso:: `HasPrevPage <#HasPrevPage>`_ -------- .. method:: HasPrevPage(page) Returns ``True`` if this page is not the last one in the wizard. The base class version implements this by calling `page.GetPrev()` but this could be undesirable if, for example, the pages are created on demand only. **Parameters:** * `page` (`wx.wizard.WizardPage `_) | **Returns:** `bool` .. seealso:: `HasNextPage <#HasNextPage>`_ -------- .. method:: Init() `No docstrings available for this method.` -------- .. method:: IsRunning() `No docstrings available for this method.` -------- .. method:: RunWizard(firstPage) Executes the wizard starting from the given page, returning ``True`` if it was successfully finished or ``False`` if user cancelled it. The `firstPage` parameter can not be ``None``. **Parameters:** * `firstPage` (`wx.wizard.WizardPage `_) | **Returns:** `bool` -------- .. method:: SetBitmap(bitmap) Sets the bitmap used for the wizard. **Parameters:** * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_) -------- .. method:: SetBorder(border) Sets width of border around page area. Default is zero. For backward compatibility, if there are no pages in `GetPageAreaSizer <#GetPageAreaSizer>`_, the default is 5 pixels. If there is a five point border around all controls in a page and the border around page area is left as zero, a five point white space along all dialog borders will be added to the control border in order to space page controls ten points from the dialog border and non-page controls. **Parameters:** * `border` (int) -------- .. method:: SetPageSize(sizePage) Sets the minimal size to be made available for the wizard pages. The wizard will take into account the size of the bitmap (if any) itself. Also, the wizard will never be smaller than the default size. The recommended way to use this function is to lay out all wizard pages using the sizers (even though the wizard is not resizeable) and then use `wx.Sizer.CalcMin <../Widgets/wx.Sizer.html#CalcMin>`_ in a loop to calculate the maximum of minimal sizes of the pages and pass it to `SetPageSize`. **Parameters:** * `sizePage` (`wx.Size <../Widgets/wx.Size.html>`_) .. warning:: This method is obsolete, use `GetPageAreaSizer <#GetPageAreaSizer>`_ instead. -------- .. method:: ShowPage(page, goingForward=True) Shows a particular wizard page. **Parameters:** * `page` (`wx.wizard.WizardPage `_) * `goingForward` (bool) | **Returns:** `bool` -------- Properties ^^^^^^^^^^ .. attribute:: Bitmap See `GetBitmap <#GetBitmap>`_ and `SetBitmap <#SetBitmap>`_ .. attribute:: CurrentPage See `GetCurrentPage <#GetCurrentPage>`_ .. attribute:: PageAreaSizer See `GetPageAreaSizer <#GetPageAreaSizer>`_ .. attribute:: PageSize See `GetPageSize <#GetPageSize>`_ and `SetPageSize <#SetPageSize>`_