1 ============================
2 wxPython 2.5 Migration Guide
3 ============================
5 This document will help explain some of the major changes in wxPython
6 2.5 since the 2.4 series and let you know what you need to do to adapt
7 your programs to those changes. Be sure to also check in the CHANGES_
8 file like usual to see info about the not so major changes and other
9 things that have been added to wxPython.
11 .. _CHANGES: CHANGES.html
17 The **wxWindows** project and library is now known as
18 **wxWidgets**. Please see here_ for more details.
20 .. _here: http://www.wxwidgets.org/name.htm
22 This won't really affect wxPython all that much, other than the fact
23 that the wxwindows.org domain name has changed to wxwidgets.org,
24 so mail list, CVS, and etc. addresses have also changed. We're going
25 to try and smooth the transition as much as possible, but I wanted you
26 all to be aware of this change if you run into any issues.
33 The import-startup-bootstrap process employed by wxPython was changed
34 such that wxWidgets and the underlying gui toolkit are **not**
35 initialized until the wx.App object is created (but before wx.App.OnInit
36 is called.) This was required because of some changes that were made
37 to the C++ wxApp class.
39 There are both benefits and potential problems with this change. The
40 benefits are that you can import wxPython without requiring access to
41 a GUI (for checking version numbers, etc.) and that in a
42 multi-threaded environment the thread that creates the app object will
43 now be the GUI thread instead of the one that imports wxPython. Some
44 potential problems are that the C++ side of the "stock-objects"
45 (wx.BLUE_PEN, wx.TheColourDatabase, etc.) are not initialized until
46 the wx.App object is created, so you should not use them until after
47 you have created your wx.App object. If you do then an exception will
48 be raised telling you that the C++ object has not been initialized
51 Also, you will probably not be able to do any kind of GUI or bitmap
52 operation unless you first have created an app object, (even on
53 Windows where most anything was possible before.)
60 wxPython is now using SWIG 1.3.x from CVS (with several of my own
61 customizations added that I hope to get folded back into the main SWIG
62 distribution.) This has some far reaching ramifications:
64 All classes derive from object and so all are now "new-style
65 classes." This also allows you to use mixin classes that are
66 new-style and to use properties, staticmethod, etc.
68 Public data members of the C++ classes are wrapped as Python
69 properties using property() instead of using
70 __getattr__/__setattr__ hacks like before. Normally you shouldn't
71 notice any difference, but if you were previously doing something
72 with __getattr__/__setattr__ in derived classes then you may have
75 Static C++ methods are wrapped using the staticmethod() feature of
76 Python and so are accessible as ClassName.MethodName as expected.
77 They are still also available as top level functions named like
78 ClassName_MethodName as before.
80 The relationship between the wxFoo and wxFooPtr classes have
81 changed for the better. Specifically, all instances that you see
82 will be wx.Foo even if they are created internally using wx.FooPtr,
83 because wx.FooPtr.__init__ will change the instance's __class__ as
84 part of the initialization. If you have any code that checks
85 class type using something like isinstance(obj, wx.FooPtr) you will
86 need to change it to isinstance(obj, wx.Foo).
93 All of the EVT_* functions are now instances of the wx.PyEventBinder
94 class. They have a __call__ method so they can still be used as
95 functions like before, but making them instances adds some
96 flexibility that I expect to take advantave of in the future.
98 wx.EvtHandler (the base class for wx.Window) now has a Bind method that
99 makes binding events to windows a little easier. Here is its
100 definition and docstring::
102 def Bind(self, event, handler, source=None, id=wxID_ANY, id2=wxID_ANY):
104 Bind an event to an event handler.
106 event One of the EVT_* objects that specifies the
107 type of event to bind.
109 handler A callable object to be invoked when the event
110 is delivered to self. Pass None to disconnect an
113 source Sometimes the event originates from a different window
114 than self, but you still want to catch it in self. (For
115 example, a button event delivered to a frame.) By
116 passing the source of the event, the event handling
117 system is able to differentiate between the same event
118 type from different controls.
120 id,id2 Used for menu IDs or for event types that require a
125 Some examples of its use::
127 self.Bind(wx.EVT_SIZE, self.OnSize)
128 self.Bind(wx.EVT_BUTTON, self.OnButtonClick, theButton)
129 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
132 The wx.Menu methods that add items to a wx.Menu have been modified
133 such that they return a reference to the wx.MenuItem that was created.
134 Additionally menu items and toolbar items have been modified to
135 automatically generate a new ID if -1 is given, similar to using -1
136 with window classess. This means that you can create menu or toolbar
137 items and event bindings without having to predefine a unique menu ID,
138 although you still can use IDs just like before if you want. For
139 example, these are all equivallent other than their specific ID
143 item = menu.Append(-1, "E&xit", "Terminate the App")
144 self.Bind(wx.EVT_MENU, self.OnExit, item)
147 item = menu.Append(wx.ID_EXIT, "E&xit", "Terminate the App")
148 self.Bind(wx.EVT_MENU, self.OnExit, item)
151 menu.Append(wx.ID_EXIT, "E&xit", "Terminate the App")
152 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
155 If you create your own custom event types and EVT_* functions, and you
156 want to be able to use them with the Bind method above then you should
157 change your EVT_* to be an instance of wx.PyEventBinder instead of a
158 function. For example, if you used to have something like this::
160 myCustomEventType = wxNewEventType()
161 def EVT_MY_CUSTOM_EVENT(win, id, func):
162 win.Connect(id, -1, myCustomEventType, func)
167 myCustomEventType = wx.NewEventType()
168 EVT_MY_CUSTOM_EVENT = wx.PyEventBinder(myCustomEventType, 1)
170 The second parameter is an integer in [0, 1, 2] that specifies the
171 number of IDs that are needed to be passed to Connect.
173 **[Changed in 2.5.2.0]** There is also an Unbind method added to
174 wx.EvtHandler that can be used to disconenct event handlers. It looks
177 def Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
179 Disconencts the event handler binding for event from self.
180 Returns True if successful.
189 The second phase of the wx Namespace Transition has begun. That means
190 that the real names of the classes and other symbols do not have the
191 'wx' prefix and the modules are located in a Python package named
192 wx. There is still a Python package named wxPython with modules
193 that have the names with the wx prefix for backwards compatibility.
194 Instead of dynamically changing the names at module load time like in
195 2.4, the compatibility modules are generated at build time and contain
196 assignment statements like this::
198 wxWindow = wx._core.Window
200 Don't let the "_core" in the name bother you. That and some other
201 modules are implementation details, and everything that was in the
202 wxPython.wx module before will still be in the wx package namespace
203 after this change. So from your code you would use it as wx.Window or
204 wxWindow if you import from the wxPython.wx module.
206 A few notes about how all of this was accomplished might be
207 interesting... SWIG is now run twice for each module that it is
208 generating code for. The first time it outputs an XML representaion
209 of the parse tree, which can be up to 20MB and 300K lines in size!
210 That XML is then run through a little Python script that creates a
211 file full of SWIG %rename directives that take the wx off of the
212 names, and also generates the Python compatibility file described
213 above that puts the wx back on the names. SWIG is then run a second
214 time to generate the C++ code to implement the extension module, and
215 uses the %rename directives that were generated in the first step.
217 Not every name is handled correctly (but the bulk of them are) and so
218 some work has to be done by hand, especially for the reverse-renamers.
219 So expect a few flaws here and there until everything gets sorted out.
221 In summary, the wx package and names without the "wx" prefix are now
222 the official form of the wxPython classes. For example::
226 class MyFrame(wx.Frame):
227 def __init__(self, parent, title):
228 wx.Frame.__init__(self, parent, -1, title)
229 p = wx.Panel(self, -1)
230 b = wx.Button(p, -1, "Do It", (10,10))
231 self.Bind(wx.EVT_BUTTON, self.JustDoIt, b)
233 def JustDoIt(self, evt):
236 app = wx.PySimpleApp()
237 f = MyFrame(None, "What's up?")
241 You shouldn't need to migrate all your modules over to use the new
242 package and names right away as there are modules in place that try to
243 provide as much backwards compatibility of the names as possible. If
244 you rewrote the above sample using "from wxPython.wx import * ", the
245 old wxNames, and the old style of event binding it will still work
254 **[Changed in 2.5.2.0]** In wxPython 2.5.1.5 there was a new
255 implementation of the wx.DC Draw and other methods that broke
256 backwards compatibility in the name of consistency. That change has
257 been reverted and the wx.DC Draw methods with 2.4 compatible
258 signatures have been restored. In addition a new set of methods have
259 been added that take wx.Point and/or wx.Size parameters instead of
260 separate integer parameters. The Draw and etc. methods now available
261 in the wx.DC class are::
264 FloodFill(self, x, y, colour, style = wx.FLOOD_SURFACE)
265 FoodFillPoint(self, pt, colour, style = wx.FLOOD_SURFACE)
268 GetPixelPoint(self, pt)
270 DrawLine(self, x1, y1, x2, y2)
271 DrawLinePoint(self, pt1, pt2)
273 CrossHair(self, x, y)
274 CrossHairPoint(self, pt)
276 DrawArc(self, x1, y1, x2, y2, xc, yc)
277 DrawArcPoint(self, pt1, pt2, centre)
279 DrawCheckMark(self, x, y, width, height)
280 DrawCheckMarkRect(self, rect)
282 DrawEllipticArc(self, x, y, w, h, sa, ea)
283 DrawEllipticArcPointSize(self, pt, sz, sa, ea)
285 DrawPoint(self, x, y)
286 DrawPointPoint(self, pt)
288 DrawRectangle(self, x, y, width, height)
289 DrawRectangleRect(self, rect)
290 DrawRectanglePointSize(self, pt, sz)
292 DrawRoundedRectangle(self, x, y, width, height, radius)
293 DrawRoundedRectangleRect(self, r, radius)
294 DrawRoundedRectanglePointSize(self, pt, sz, radius)
296 DrawCircle(self, x, y, radius)
297 DrawCirclePoint(self, pt, radius)
299 DrawEllipse(self, x, y, width, height)
300 DrawEllipseRect(self, rect)
301 DrawEllipsePointSize(self, pt, sz)
303 DrawIcon(self, icon, x, y)
304 DrawIconPoint(self, icon, pt)
306 DrawBitmap(self, bmp, x, y, useMask = False)
307 DrawBitmapPoint(self, bmp, pt, useMask = False)
309 DrawText(self, text, x, y)
310 DrawTextPoint(self, text, pt)
312 DrawRotatedText(self, text, x, y, angle)
313 DrawRotatedTextPoint(self, text, pt, angle)
315 bool Blit(self, xdest, ydest, width, height, sourceDC, xsrc, ysrc,
316 rop = wx.COPY, useMask = False, xsrcMask = -1, ysrcMask = -1)
317 BlitPointSize(self, destPt, sz, sourceDC, srcPt, rop = wx.COPY,
318 useMask = False, srcPtMask = wxDefaultPosition)
321 SetClippingRegion(self, x, y, width, height)
322 SetClippingRegionPointSize(self, pt, sz)
323 SetClippingRegionAsRegion(self, region)
324 SetClippingRect(self, rect)
330 Building, Extending and Embedding wxPython
331 ------------------------------------------
333 wxPython's setup.py script now expects to use existing libraries for
334 the contribs (gizmos, stc, xrc, etc.) rather than building local
335 copies of them. If you build your own copies of wxPython please be
336 aware that you now need to also build the ogl, stc, xrc, and gizmos
337 libraries in addition to the main wx lib.
339 The wxPython.h and other header files are now in
340 .../wxPython/include/wx/wxPython instead of in wxPython/src. You
341 should include it via the "wx/wxPython/wxPython.h" path and add
342 .../wxPython/include to your list of include paths. On OSX and
343 unix-like systems the wxPython headers are installed to the same place
344 that the wxWidgets headers are installed, so if you are building
345 wxPython compatible extensions on those platforms then your include
346 path should already be set properly.
348 If you are also using SWIG for your extension then you'll need to
349 adapt how the wxPython .i files are imported into your .i files. See
350 the wxPython sources for examples. Your modules will need to at least
351 ``%import core.i``, and possibly others if you need the definition of
352 other classes. Since you will need them to build your modules using
353 SWIG, the main wxPython .i files are also installed with the wxPython
354 headers in an i_files sibdirectory. It should be enough to pass a
355 -I/pathname on the command line for SWIG to find the files.
357 The bulk of wxPython's setup.py has been moved to another module,
358 wx/build/config.py. This module will be installed as part of wxPython
359 so 3rd party modules that wish to use the same setup/configuration
360 code can do so simply by importing this module from their own setup.py
361 scripts using ``import wx.build.config``.
363 You no longer need to call wxClassInfo::CleanUpClasses() and
364 wxClassInfo::InitializeClasses() in your extensions or when embedding
367 The usage of wxPyBeginAllowThreads and wxPyEndAllowThreads has changed
368 slightly. wxPyBeginAllowThreads now returns a boolean value that must
369 be passed to the coresponding wxPyEndAllowThreads function call. This
370 is to help do the RightThing when calls to these two functions are
371 nested, or if calls to external code in other extension modules that
372 are wrapped in the standard Py_(BEGIN|END)_ALLOW_THERADS may result in
373 wx event handlers being called (such as during the call to
378 Two (or Three!) Phase Create
379 ----------------------------
381 If you use the Precreate/Create method of instantiating a window, (for
382 example, to set an extended style flag, or for XRC handlers) then
383 there is now a new method named PostCreate to help with transplanting
384 the brain of the prewindow instance into the derived window instance.
387 class MyDialog(wx.Dialog):
388 def __init__(self, parent, ID, title, pos, size, style):
390 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
391 pre.Create(parent, ID, title, pos, size, style)
399 The hack allowing the old "option" keyword parameter has been removed.
400 If you use keyword args with w.xSizer Add, Insert, or Prepend methods
401 then you will need to use the ``proportion`` name instead of
402 ``option``. (The ``proportion`` keyword was also allowed in 2.4.2.4.)
404 When adding a spacer to a sizer you now need to use a wx.Size or a
405 2-integer sequence instead of separate width and height parameters.
406 This was optionally allowed in 2.4, but now it is required. This
407 allows for more consistency in how you add the various types of items
408 to a sizer. The first parameter defines the item (instead of the
409 possibily first two, depending on if you are doing a spacer or not,)
410 and that item can either be a window, a sizer or a spacer (which can
411 be a sequence or a wx.Size.) Removing the option for separate width
412 and height parameters greatly simplified the wrapper code.
414 The wx.GridBagSizer class (very similar to the RowColSizer in the
415 library) has been added to C++ and wrapped for wxPython. It can also
418 You should not use AddWindow, AddSizer, AddSpacer (and similar for
419 Insert, Prepend, and etc.) methods any longer. Just use Add and the
420 wrappers will figure out what to do. **[Changed in 2.5.2.0]**
421 AddWindow, AddSize, AddSpacer and etc. will now issue a
424 **[Changed in 2.5.2.0]** wx.ADJUST_MINSIZE is now the default
425 behaviour for window items in sizers. This means that the item's
426 GetMinSize and/or GetBestSize will be called when calculating layout
427 and the return value from that will be used for the minimum size used
428 by the sizer. The wx.FIXED_MINSIZE flag was added that will cause the
429 sizer to use the old behaviour in that it will *not* call the window's
430 methods to determine the new best size, instead the minsize that the
431 window had when added to the sizer (or the size the window was created
432 with) will always be used.
434 Related to the above, when controls and some other window types are
435 created either the size passed to the constructor, or their "best
436 size" if an explicit size was not passed in, is set as the window's
437 minimal size. For non top-level windows that hasn't meant much in the
438 past, but now the sizers are sensitive to the window's minimal size.
439 The key point to understand here is that it is no longer the window's
440 size it has when added to the sizer that matters, but its minimal
441 size. So you might have some issues to iron out if you create a
442 control without a size and then set its size to something before
443 adding it to the sizer. Since it's minimal size is probably not the
444 size you set then the sizer will appear to be misbehaving. The fix is
445 to either set the size when calling the window's constructor, or to
446 reset the min size by calling SetSizeHints. You can call SetSizeHints
447 at anytime to change the minsize of a window, just call the sizer's
448 Layout method to redistribute the controls as needed.
455 Added wx.PlatformInfo which is a tuple containing strings that
456 describe the platform and build options of wxPython. This lets you
457 know more about the build than just the __WXPORT__ value that
458 wx.Platform contains, such as if it is a GTK2 build. For example,
461 if wx.Platform == "__WXGTK__":
466 if "__WXGTK__" in wx.PlatformInfo:
469 and you can specifically check for a wxGTK2 build by looking for
470 "gtk2" in wx.PlatformInfo. Unicode builds are also detectable this
471 way. If there are any other platform/toolkit/build flags that make
472 sense to add to this tuple please let me know.
474 BTW, wx.Platform will probably be deprecated in the future.
481 Lindsay Mathieson's newest wxActiveX_ class has been wrapped into a new
482 extension module called wx.activex. It is very generic and dynamic
483 and should allow hosting of arbitray ActiveX controls within your
484 wxPython apps. So far I've tested it with IE, PDF, and Flash
485 controls, (and there are new samples in the demo and also library
486 modules supporting these.)
488 .. _wxActiveX: http://members.optusnet.com.au/~blackpaw1/wxactivex.html
490 The new wx.activex module contains a bunch of code, but the most
491 important things to look at are ActiveXWindow and ActiveXEvent.
492 ActiveXWindow derives from wxWindow and the constructor accepts a
493 CLSID for the ActiveX Control that should be created. (There is also
494 a CLSID class that can convert from a progID or a CLSID String.) The
495 ActiveXWindow class simply adds methods that allow you to query some
496 of the TypeInfo exposed by the ActiveX object, and also to get/set
497 properties or call methods by name. The Python implementation
498 automatically handles converting parameters and return values to/from
499 the types expected by the ActiveX code as specified by the TypeInfo,
500 (just bool, integers, floating point, strings and None/Empty so far,
501 but more can be handled later.)
503 That's pretty much all there is to the class, as I mentioned before it
504 is very generic and dynamic. Very little is hard-coded and everything
505 that is done with the actual ActiveX control is done at runtime and
506 referenced by property or method name. Since Python is such a dynamic
507 language this is a very good match. I thought for a while about doing
508 some Python black-magic and making the specific methods/properties of
509 the actual ActiveX control "appear" at runtime, but then decided that
510 it would be better and more understandable to do it via subclassing.
511 So there is a utility class in wx.activex that given an existing
512 ActiveXWindow instance can generate a .py module containing a derived
513 class with real methods and properties that do the Right Thing to
514 reflect those calls to the real ActiveX control. There is also a
515 script/tool module named genaxmodule that given a CLSID or progID and
516 a class name, will generate the module for you. There are a few
517 examples of the output of this tool in the wx.lib package, see
518 iewin.py, pdfwin.py and flashwin.py.
520 Currently the genaxmodule tool will tweak some of the names it
521 generates, but this can be controled if you would like to do it
522 differently by deriving your own class from GernerateAXModule,
523 overriding some methods and then using this class from a tool like
524 genaxmodule. [TODO: make specifying a new class on genaxmodule's
525 command-line possible.] The current default behavior is that any
526 event names that start with "On" will have the "On" dropped, property
527 names are converted to all lower case, and if any name is a Python
528 keyword it will have an underscore appended to it. GernerateAXModule
529 does it's best when generating the code in the new module, but it can
530 only be as good as the TypeInfo data available from the ActiveX
531 control so sometimes some tweaking will be needed. For example, the
532 IE web browser control defines the Flags parameter of the Navigate2
533 method as required, but MSDN says it is optional.
535 It is intended that this new wx.activex module will replace both the
536 older version of Lindsay's code available in iewin.IEHtmlWindow, and
537 also the wx.lib.activexwraper module. Probably the biggest
538 differences you'll ecounter in migrating activexwrapper-based code
539 (besides events working better without causing deadlocks) is that
540 events are no longer caught by overriding methods in your derived
541 class. Instead ActiveXWindow uses the wx event system and you bind
542 handlers for the ActiveX events exactly the same way you do for any wx
543 event. There is just one extra step needed and that is creating an
544 event ID from the ActiveX event name, and if you use the genaxmodule
545 tool then this extra step will be handled for you there. For example,
546 for the StatusTextChange event in the IE web browser control, this
547 code is generated for you::
549 wxEVT_StatusTextChange = wx.activex.RegisterActiveXEvent('StatusTextChange')
550 EVT_StatusTextChange = wx.PyEventBinder(wxEVT_StatusTextChange, 1)
552 and you would use it in your code like this::
554 self.Bind(iewin.EVT_StatusTextChange, self.UpdateStatusText, self.ie)
556 When the event happens and your event handler function is called the
557 event properties from the ActiveX control (if any) are converted to
558 attributes of the event object passed to the handler. (Can you say
559 'event' any more times in a single sentence? ;-) ) For example the
560 StatusTextChange event will also send the text that should be put into
561 the status line as an event parameter named "Text" and you can access
562 it your handlers as an attribute of the event object like this::
564 def UpdateStatusText(self, evt):
565 self.SetStatusText(evt.Text)
567 Usually these event object attributes should be considered read-only,
568 but some will be defined by the TypeInfo as output parameters. In
569 those cases if you modify the event object's attribute then that value
570 will be returned to the ActiveX control. For example, to prevent a
571 new window from being opened by the IE web browser control you can do
572 this in the handler for the iewin.EVT_NewWindow2 event::
574 def OnNewWindow2(self, evt):
577 So how do you know what methods, events and properties that an ActiveX
578 control supports? There is a funciton in wx.activex named GetAXInfo
579 that returns a printable summary of the TypeInfo from the ActiveX
580 instance passed in. You can use this as an example of how to browse
581 the TypeInfo provided, and there is also a copy of this function's
582 output appended as a comment to the modules produced by the
583 genaxmodule tool. Beyond that you'll need to consult the docs
584 provided by the makers of the ActiveX control that you are using.
588 OGL is dead! LONG LIVE OGL!
589 ---------------------------
591 **[Changed in 2.5.2.0]**
593 The wx.ogl module has been deprecated in favor of the new Python port
594 of the OGL library located at wx.lib.ogl contributed by Pierre Hjälm.
595 This will hopefully greatly extend the life of OGL within wxPython by
596 making it more easily maintainable and less prone to getting rusty as
597 there seems to be less and less interest in maintaining the C++
600 There are only a few known compatibility issues at this time. First
601 is the location of OGL. The deprecated version is located in the
602 wx.ogl module, and the new version is in the wx.lib.ogl package. So
603 this just means that to start using the new version you need to adjust
604 your imports. So if your code currently has something like this::
609 Then just change it to this::
612 import wx.lib.ogl as ogl
614 The other compatibility issue deals with removing a wart in the
615 original API that was necessary in order to allow overloaded methods
616 in derived classes to call the same method in the base class when
617 using the old SWIG. Instead dedaling with the wart you can now just
618 call the base class method like you woudl for any other Python class.
619 For example, if you had to do something like this previously::
621 class MyDividedShape(ogl.DividedShape):
623 def OnSizingEndDragLeft(self, pt, x, y, keys, attch):
624 self.base_OnSizingEndDragLeft(pt, x, y, keys, attch)
627 You will need to change it to be like this::
629 class MyDividedShape(ogl.DividedShape):
631 def OnSizingEndDragLeft(self, pt, x, y, keys, attch):
632 ogl.DividedShape.OnSizingEndDragLeft(self, pt, x, y, keys, attch)
640 Instead of over a dozen separate extension modules linked together
641 into a single extension module, the "core" module is now just a few
642 extensions that are linked independently, and then merged together
643 later into the main namespace via Python code.
645 Because of the above and also because of the way the new SWIG works,
646 the "internal" module names have changed, but you shouldn't have been
647 using them anyway so it shouldn't bother you. ;-) In case you were
648 erroneously using them in 2.4, here are the internal extension modules
673 They have been replaced by the following, but please remember that
674 these are just "implementation details" and you should really be using
675 the objects in these modules only via the wx or wxPython.wx packages:
684 The help module no longer exists and the classes therein are now part
685 of the core module imported with wxPython.wx or the wx package.
693 wxPyDefaultPosition and wxPyDefaultSize are gone. Use the
694 wxDefaultPosition and wxDefaultSize objects instead.
696 Similarly, the wxSystemSettings backwards compatibiility aliases for
697 GetSystemColour, GetSystemFont and GetSystemMetric have also gone into
698 the bit-bucket. Use GetColour, GetFont and GetMetric instead.
700 Use the Python True/False constants instead of the true, TRUE, false,
701 FALSE that used to be provided with wxPython.
703 Use None instead of the ancient and should have been removed a long
704 time ago wx.NULL alias.
706 wx.TreeCtrl.GetFirstChild no longer needs to be passed the cookie
707 variable as the 2nd parameter. It still returns it though, for use
710 The wx.NO_FULL_REPAINT_ON_RESIZE style is now the default style for
711 all windows. The name still exists for compatibility, but it is set
712 to zero. If you want to disable the setting (so it matches the old
713 default) then you need to use the new wx.FULL_REPAINT_ON_RESIZE style
714 flag otherwise only the freshly exposed areas of the window will be
717 wxPyTypeCast has been removed. Since we've had the OOR (Original
718 Object Return) for a couple years now there should be no need to use
721 If you use the old wxPython package and wxPython.wx namespace then
722 there are compatibility aliases for much of the above items.
724 The wxWave class has been renamed to wxSound, and now has a slightly
727 wx.TaskbarIcon works on wxGTK-based platforms (for some window
728 managers,) however you have to manage it a little bit more than you
729 did before. Basically, the app will treat it like a top-level frame
730 in that if the wx.TaskBarIcon still exists when all the frames are
731 closed then the app will still not exit. You need to ensure that the
732 wx.TaskBarIcon is destroyed when your last Frame is closed. For
733 wxPython apps it is usually enough if your main frame object holds the
734 only reference to the wx.TaskBarIcon, then when the frame is closed
735 Python reference counting takes care of the rest.
737 Before Python 2.3 it was possible to pass a floating point object as a
738 parameter to a function that expected an integer, and the
739 PyArg_ParseTuple family of functions would automatically convert to
740 integer by truncating the fractional portion of the number. With
741 Python 2.3 that behavior was deprecated and a deprecation warning is
742 raised when you pass a floating point value, (for example, calling
743 wx.DC.DrawLine with floats for the position and size,) and lots of
744 developers using wxPython had to scramble to change their code to call
745 int() before calling wxPython methods. Recent changes in SWIG have
746 moved the conversion out of PyArg_ParseTuple to custom code that SWIG
747 generates. Since the default conversion fragment was a little too
748 strict and didn't generate a very meaningful exception when it failed,
749 I decided to use a custom fragment instead, and it turned out that
750 it's very easy to allow floats to be converted again just like they
751 used to be. So, in a nutshell, any numeric type that can be
752 converted to an integer is now legal to be passed to SWIG wrapped
753 functions in wxPython for parameters that are expecting an integer.
754 If the object is not already an integer then it will be asked to
755 convert itself to one. A similar conversion fragment is in place for
756 parameters that expect floating point values.
758 **[Changed in 2.5.2.0]** The MaskedEditCtrl modules have been moved
759 to their own sub-package, wx.lib.masked. See the docstrings and demo
760 for changes in capabilities, usage, etc.
762 **[Changed in 2.5.2.0]** wx.MaskColour constructor has been deprecated
763 and will raise a DeprecationWarning if used. The main wx.Mask
764 constructor has been modified to be compatible with wx.MaskColour so
765 you should use it instead.