1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.adv.Wizard:
==========================================================================================================================================
|phoenix_title| **wx.adv.Wizard**
==========================================================================================================================================
:ref:`wx.adv.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 :ref:`wx.adv.Wizard` class using either the non-default constructor or a default one followed by call to the :meth:`wx.adv.Wizard.Create` function. Then you should add all pages you want the wizard to show and call :meth:`wx.adv.Wizard.RunWizard` . Finally, don't forget to call ``"wizard->Destroy()"`` , otherwise your application will hang on exit due to an undestroyed window.
You can supply a bitmap to display on the left of the wizard, either for all pages or for individual pages. If you need to have the bitmap resize to the height of the wizard, call :meth:`wx.adv.Wizard.SetBitmapPlacement` and if necessary, :meth:`wx.adv.Wizard.SetBitmapBackgroundColour` and :meth:`wx.adv.Wizard.SetMinimumBitmapWidth` .
To make wizard pages scroll when the display is too small to fit the whole dialog, you can switch layout adaptation on globally with :meth:`wx.Dialog.EnableLayoutAdaptation` or per dialog with :meth:`wx.Dialog.SetLayoutAdaptationMode` . For more about layout adaptation, see :ref:`Automatic Scrolled Dialogs <automatic scrolled dialogs>`.
.. _Wizard-events:
|events| Events Emitted by this Class
=====================================
Handlers bound for the following event types will receive a :ref:`wx.adv.WizardEvent` parameter.
- EVT_WIZARD_PAGE_CHANGED: The page has just been changed (this event cannot be vetoed).
- EVT_WIZARD_PAGE_CHANGING: The page is being changed (this event can be vetoed).
- EVT_WIZARD_BEFORE_PAGE_CHANGED: Called after Next is clicked but before GetNext is called. Unlike ``EVT_WIZARD_CHANGING``, the handler for this function can change state that might affect the return value of GetNext. This event can be vetoed.
- EVT_WIZARD_PAGE_SHOWN: The page was shown and laid out (this event cannot be vetoed).
- EVT_WIZARD_CANCEL: The user attempted to cancel the wizard (this event may also be vetoed).
- EVT_WIZARD_HELP: The wizard help button was pressed.
- EVT_WIZARD_FINISHED: The wizard finished button was pressed.
|phoenix_title| Extended styles
===============================
.. _Wizard-extra-styles:
|extra_styles| Window Extra Styles
==================================
Use the :meth:`wx.Window.SetExtraStyle` function to set the following style. You will need to use two-step construction (use the default constructor, call :meth:`~wx.adv.Wizard.SetExtraStyle`, then call Create). This class supports the following extra styles:
- ``wx.adv.WIZARD_EX_HELPBUTTON``: Shows a Help button using ``wx.ID_HELP``.
See also
:ref:`wx.Dialog` for other extended styles.
.. seealso:: :ref:`wx.adv.WizardEvent`, :ref:`wx.adv.WizardPage`, :ref:`Wizard Sample <wizard sample>`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>Wizard</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.adv.Wizard_inheritance.png" alt="Inheritance diagram of Wizard" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> <area shape="rect" id="node3" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="34,237,192,267"/> <area shape="rect" id="node5" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="42,315,184,344"/> <area shape="rect" id="node4" href="wx.Window.html" title="wx.Window" alt="" coords="69,160,157,189"/> <area shape="rect" id="node8" href="wx.Dialog.html" title="wx.Dialog" alt="" coords="72,392,153,421"/> <area shape="rect" id="node7" href="wx.adv.Wizard.html" title="wx.adv.Wizard" alt="" coords="58,469,168,499"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.adv.Wizard.__init__` Default constructor.
:meth:`~wx.adv.Wizard.Create` Creates the wizard dialog.
:meth:`~wx.adv.Wizard.FitToPage` This method is obsolete, use :meth:`~Wizard.GetPageAreaSizer` instead.
:meth:`~wx.adv.Wizard.GetBitmap` Returns the bitmap used for the wizard.
:meth:`~wx.adv.Wizard.GetBitmapBackgroundColour` Returns the colour that should be used to fill the area not taken up by the wizard or page bitmap, if a non-zero bitmap placement flag has been set.
:meth:`~wx.adv.Wizard.GetBitmapPlacement` Returns the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the page height.
:meth:`~wx.adv.Wizard.GetCurrentPage` Get the current page while the wizard is running.
:meth:`~wx.adv.Wizard.GetMinimumBitmapWidth` Returns the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap if a non-zero bitmap placement flag has been set.
:meth:`~wx.adv.Wizard.GetPageAreaSizer` Returns pointer to page area sizer.
:meth:`~wx.adv.Wizard.GetPageSize` Returns the size available for the pages.
:meth:`~wx.adv.Wizard.HasNextPage` Return ``True`` if this page is not the last one in the wizard.
:meth:`~wx.adv.Wizard.HasPrevPage` Returns ``True`` if this page is not the last one in the wizard.
:meth:`~wx.adv.Wizard.IsRunning`
:meth:`~wx.adv.Wizard.RunWizard` Executes the wizard starting from the given page, returning ``True`` if it was successfully finished or ``False`` if user cancelled it.
:meth:`~wx.adv.Wizard.SetBitmap` Sets the bitmap used for the wizard.
:meth:`~wx.adv.Wizard.SetBitmapBackgroundColour` Sets the colour that should be used to fill the area not taken up by the wizard or page bitmap, if a non-zero bitmap placement flag has been set.
:meth:`~wx.adv.Wizard.SetBitmapPlacement` Sets the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the page height.
:meth:`~wx.adv.Wizard.SetBorder` Sets width of border around page area.
:meth:`~wx.adv.Wizard.SetMinimumBitmapWidth` Sets the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap if a non-zero bitmap placement flag has been set.
:meth:`~wx.adv.Wizard.SetPageSize` Sets the minimal size to be made available for the wizard pages.
:meth:`~wx.adv.Wizard.ShowPage` Show the given wizard page.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.adv.Wizard.Bitmap` See :meth:`~wx.adv.Wizard.GetBitmap` and :meth:`~wx.adv.Wizard.SetBitmap`
:attr:`~wx.adv.Wizard.BitmapBackgroundColour` See :meth:`~wx.adv.Wizard.GetBitmapBackgroundColour` and :meth:`~wx.adv.Wizard.SetBitmapBackgroundColour`
:attr:`~wx.adv.Wizard.BitmapPlacement` See :meth:`~wx.adv.Wizard.GetBitmapPlacement` and :meth:`~wx.adv.Wizard.SetBitmapPlacement`
:attr:`~wx.adv.Wizard.CurrentPage` See :meth:`~wx.adv.Wizard.GetCurrentPage`
:attr:`~wx.adv.Wizard.MinimumBitmapWidth` See :meth:`~wx.adv.Wizard.GetMinimumBitmapWidth` and :meth:`~wx.adv.Wizard.SetMinimumBitmapWidth`
:attr:`~wx.adv.Wizard.PageAreaSizer` See :meth:`~wx.adv.Wizard.GetPageAreaSizer`
:attr:`~wx.adv.Wizard.PageSize` See :meth:`~wx.adv.Wizard.GetPageSize` and :meth:`~wx.adv.Wizard.SetPageSize`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.adv.Wizard(Dialog)
**Possible constructors**::
Wizard()
Wizard(parent, id=ID_ANY, title="", bitmap=NullBitmap,
pos=DefaultPosition, style=DEFAULT_DIALOG_STYLE)
Wizard is the central class for implementing 'wizard-like' dialogs.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
Default constructor.
Use this if you wish to derive from :ref:`wx.adv.Wizard` and then call :meth:`Create` , for example if you wish to set an extra style with :meth:`wx.Window.SetExtraStyle` between the two calls.
**~~~**
**__init__** `(self, parent, id=ID_ANY, title=EmptyString, bitmap=NullBitmap, pos=DefaultPosition, style=DEFAULT_DIALOG_STYLE)`
Constructor which really creates the wizard :meth:`Create` .
Notice that unlike almost all other wxWidgets classes, there is no `size` parameter in the :ref:`wx.adv.Wizard` constructor because the wizard will have a predefined default size by default. If you want to change this, you should use the :meth:`GetPageAreaSizer` function.
:param `parent`: The parent window, may be ``None``.
:type `parent`: wx.Window
:param `id`: The id of the dialog, will usually be just ``wx.ID_ANY``.
:type `id`: int
:param `title`: The title of the dialog.
:type `title`: string
:param `bitmap`: The default bitmap used in the left side of the wizard. See also :meth:`GetBitmap` .
:type `bitmap`: wx.Bitmap
:param `pos`: The position of the dialog, it will be centered on the screen by default.
:type `pos`: wx.Point
:param `style`: Window style is passed to :ref:`wx.Dialog`.
:type `style`: long
**~~~**
.. method:: Create(self, parent, id=ID_ANY, title=EmptyString, bitmap=NullBitmap, pos=DefaultPosition, style=DEFAULT_DIALOG_STYLE)
Creates the wizard dialog.
Must be called if the default constructor had been used to create the object.
Notice that unlike almost all other wxWidgets classes, there is no `size` parameter in the :ref:`wx.adv.Wizard` constructor because the wizard will have a predefined default size by default. If you want to change this, you should use the :meth:`GetPageAreaSizer` function.
:param `parent`: The parent window, may be ``None``.
:type `parent`: wx.Window
:param `id`: The id of the dialog, will usually be just -1.
:type `id`: int
:param `title`: The title of the dialog.
:type `title`: string
:param `bitmap`: The default bitmap used in the left side of the wizard. See also :meth:`GetBitmap` .
:type `bitmap`: wx.Bitmap
:param `pos`: The position of the dialog, it will be centered on the screen by default.
:type `pos`: wx.Point
:param `style`: Window style is passed to :ref:`wx.Dialog`.
:type `style`: long
:rtype: `bool`
.. method:: FitToPage(self, firstPage)
This method is obsolete, use :meth:`GetPageAreaSizer` instead.
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.
:param `firstPage`:
:type `firstPage`: wx.adv.WizardPage
.. method:: GetBitmap(self)
Returns the bitmap used for the wizard.
:rtype: :ref:`Bitmap`
.. method:: GetBitmapBackgroundColour(self)
Returns the colour that should be used to fill the area not taken up by the wizard or page bitmap, if a non-zero bitmap placement flag has been set.
See also :meth:`SetBitmapPlacement` .
:rtype: :ref:`Colour`
.. method:: GetBitmapPlacement(self)
Returns the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the page height.
By default, placement is 0 (no expansion is done).
See also :meth:`SetBitmapPlacement` for the possible values.
:rtype: `int`
.. method:: GetCurrentPage(self)
Get the current page while the wizard is running.
``None`` is returned if :meth:`RunWizard` is not being executed now.
:rtype: :ref:`wx.adv.WizardPage`
.. method:: GetMinimumBitmapWidth(self)
Returns the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap if a non-zero bitmap placement flag has been set.
See also :meth:`SetBitmapPlacement` .
:rtype: `int`
.. method:: GetPageAreaSizer(self)
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 :meth:`wx.adv.WizardPage.GetNext` to any page inserted into the sizer.
Third, the minimal size specified using :meth:`SetPageSize` and :meth:`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 :meth:`wx.Sizer.SetMinSize` to enlarge it beyond the minimal size. If ``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 :meth:`wx.Sizer.SetMinSize` . Adding pages to the page area sizer affects the default border width around page area that can be altered with :meth:`SetBorder` .
:rtype: :ref:`Sizer`
.. method:: GetPageSize(self)
Returns the size available for the pages.
:rtype: :ref:`Size`
.. method:: HasNextPage(self, page)
Return ``True`` if this page is not the last one in the wizard.
The base class version implements this by calling :meth:`page->GetNext` but this could be undesirable if, for example, the pages are created on demand only.
:param `page`:
:type `page`: wx.adv.WizardPage
:rtype: `bool`
.. seealso:: :meth:`HasPrevPage`
.. method:: HasPrevPage(self, page)
Returns ``True`` if this page is not the last one in the wizard.
The base class version implements this by calling :meth:`page->GetPrev` but this could be undesirable if, for example, the pages are created on demand only.
:param `page`:
:type `page`: wx.adv.WizardPage
:rtype: `bool`
.. seealso:: :meth:`HasNextPage`
.. method:: IsRunning(self)
:rtype: `bool`
.. method:: RunWizard(self, firstPage)
Executes the wizard starting from the given page, returning ``True`` if it was successfully finished or ``False`` if user cancelled it.
The `firstPage` cannot be ``None``.
:param `firstPage`:
:type `firstPage`: wx.adv.WizardPage
:rtype: `bool`
.. method:: SetBitmap(self, bitmap)
Sets the bitmap used for the wizard.
:param `bitmap`:
:type `bitmap`: wx.Bitmap
.. method:: SetBitmapBackgroundColour(self, colour)
Sets the colour that should be used to fill the area not taken up by the wizard or page bitmap, if a non-zero bitmap placement flag has been set.
See also :meth:`SetBitmapPlacement` .
:param `colour`:
:type `colour`: wx.Colour
.. method:: SetBitmapPlacement(self, placement)
Sets the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the page height.
By default, placement is 0 (no expansion is done). `placement` is a bitlist with the following possible values:
- ``wx.adv.WIZARD_VALIGN_TOP``: Aligns the bitmap at the top.
- ``wx.adv.WIZARD_VALIGN_CENTRE``: Centres the bitmap vertically.
- ``wx.adv.WIZARD_VALIGN_BOTTOM``: Aligns the bitmap at the bottom.
- ``wx.adv.WIZARD_HALIGN_LEFT``: Left-aligns the bitmap.
- ``wx.adv.WIZARD_HALIGN_CENTRE``: Centres the bitmap horizontally.
- ``wx.adv.WIZARD_HALIGN_RIGHT``: Right-aligns the bitmap.
- ``wx.adv.WIZARD_TILE``: todo 52.
See also :meth:`SetMinimumBitmapWidth` .
:param `placement`:
:type `placement`: int
.. method:: SetBorder(self, border)
Sets width of border around page area.
Default is zero. For backward compatibility, if there are no pages in :meth:`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.
:param `border`:
:type `border`: int
.. method:: SetMinimumBitmapWidth(self, width)
Sets the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap if a non-zero bitmap placement flag has been set.
If this is not set when using bitmap placement, the initial layout may be incorrect.
See also :meth:`SetBitmapPlacement` .
:param `width`:
:type `width`: int
.. method:: SetPageSize(self, 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 resizable) and then use :meth:`wx.Sizer.CalcMin` in a loop to calculate the maximum of minimal sizes of the pages and pass it to :meth:`SetPageSize` .
:param `sizePage`:
:type `sizePage`: wx.Size
.. method:: ShowPage(self, page, goingForward=True)
Show the given wizard page.
Calls TransferDataFromWindow on the current page first, and
returns ``False`` without changing the page if it returned ``False``.
Returns True/False to indicate if the page was actually
changed.
:param `page`:
:type `page`: wx.adv.WizardPage
:param `goingForward`:
:type `goingForward`: bool
:rtype: `bool`
.. attribute:: Bitmap
See :meth:`~wx.adv.Wizard.GetBitmap` and :meth:`~wx.adv.Wizard.SetBitmap`
.. attribute:: BitmapBackgroundColour
See :meth:`~wx.adv.Wizard.GetBitmapBackgroundColour` and :meth:`~wx.adv.Wizard.SetBitmapBackgroundColour`
.. attribute:: BitmapPlacement
See :meth:`~wx.adv.Wizard.GetBitmapPlacement` and :meth:`~wx.adv.Wizard.SetBitmapPlacement`
.. attribute:: CurrentPage
See :meth:`~wx.adv.Wizard.GetCurrentPage`
.. attribute:: MinimumBitmapWidth
See :meth:`~wx.adv.Wizard.GetMinimumBitmapWidth` and :meth:`~wx.adv.Wizard.SetMinimumBitmapWidth`
.. attribute:: PageAreaSizer
See :meth:`~wx.adv.Wizard.GetPageAreaSizer`
.. attribute:: PageSize
See :meth:`~wx.adv.Wizard.GetPageSize` and :meth:`~wx.adv.Wizard.SetPageSize`
|