]> git.saurik.com Git - wxWidgets.git/blame - wxPython/docs/MigrationGuide.txt
Add wxTimerEvent to Events category
[wxWidgets.git] / wxPython / docs / MigrationGuide.txt
CommitLineData
d14a1e28
RD
1============================
2wxPython 2.5 Migration Guide
3============================
4
5This document will help explain some of the major changes in wxPython
62.5 and let you know what you need to do to adapt your programs to
33ab916f 7those changes. Be sure to also check in the CHANGES_ file like
d14a1e28
RD
8usual to see info about the not so major changes and other things that
9have been added to wxPython.
10
33ab916f
RD
11.. _CHANGES: CHANGES.html
12
d14a1e28 13
e8a71fa0
RD
14wxName Change
15-------------
16
17The **wxWindows** project and library is now known as
18**wxWidgets**. Please see here_ for more details.
19
29bfe46b 20.. _here: http://www.wxwidgets.org/name.htm
e8a71fa0
RD
21
22This won't really affect wxPython all that much, other than the fact
23that the wxwindows.org domain name will be changing to wxwidgets.org,
24so mail list, CVS, and etc. addresses will be changing. We're going
25to try and smooth the transition as much as possible, but I wanted you
26all to be aware of this change if you run into any issues.
27
28
d14a1e28
RD
29
30Module Initialization
31---------------------
32
33The import-startup-bootstrap process employed by wxPython was changed
e8a71fa0 34such that wxWidgets and the underlying gui toolkit are **not**
d14a1e28
RD
35initialized until the wx.App object is created (but before wx.App.OnInit
36is called.) This was required because of some changes that were made
37to the C++ wxApp class.
38
39There are both benefits and potential problems with this change. The
40benefits are that you can import wxPython without requiring access to
41a GUI (for checking version numbers, etc.) and that in a
42multi-threaded environment the thread that creates the app object will
43now be the GUI thread instead of the one that imports wxPython. Some
44potential problems are that the C++ side of the "stock-objects"
45(wx.BLUE_PEN, wx.TheColourDatabase, etc.) are not initialized until
46the wx.App object is created, so you should not use them until after
61563ef3 47you have created your wx.App object. If you do then an exception will
cb2d8b77 48be raised telling you that the C++ object has not been initialized
61563ef3 49yet.
d14a1e28
RD
50
51Also, you will probably not be able to do any kind of GUI or bitmap
52operation unless you first have created an app object, (even on
53Windows where most anything was possible before.)
54
55
56
57SWIG 1.3
58--------
59
60wxPython is now using SWIG 1.3.x from CVS (with several of my own
61customizations added that I hope to get folded back into the main SWIG
62distribution.) This has some far reaching ramifications:
63
64 All classes derive from object and so all are now "new-style
d7403ad2
RD
65 classes." This also allows you to use mixin classes that are
66 new-style and to use properties, staticmethod, etc.
d14a1e28
RD
67
68 Public data members of the C++ classes are wrapped as Python
d7403ad2
RD
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
73 to adjust things.
74
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
d14a1e28
RD
78 ClassName_MethodName as before.
79
80 The relationship between the wxFoo and wxFooPtr classes have
81 changed for the better. Specifically, all instances that you see
d7403ad2
RD
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
d14a1e28 84 part of the initialization. If you have any code that checks
d7403ad2
RD
85 class type using something like isinstance(obj, wx.FooPtr) you will
86 need to change it to isinstance(obj, wx.Foo).
d14a1e28
RD
87
88
89
90Binding Events
91--------------
92
93All of the EVT_* functions are now instances of the wx.PyEventBinder
94class. They have a __call__ method so they can still be used as
95functions like before, but making them instances adds some
29bfe46b 96flexibility that I expect to take advantave of in the future.
d14a1e28
RD
97
98wx.EvtHandler (the base class for wx.Window) now has a Bind method that
99makes binding events to windows a little easier. Here is its
100definition and docstring::
101
102 def Bind(self, event, handler, source=None, id=wxID_ANY, id2=wxID_ANY):
103 """
104 Bind an event to an event handler.
105
106 event One of the EVT_* objects that specifies the
107 type of event to bind.
108
109 handler A callable object to be invoked when the event
110 is delivered to self. Pass None to disconnect an
111 event handler.
112
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.
119
120 id,id2 Used for menu IDs or for event types that require a
121 range of IDs
122
123 """
124
125Some examples of its use::
126
127 self.Bind(wx.EVT_SIZE, self.OnSize)
128 self.Bind(wx.EVT_BUTTON, self.OnButtonClick, theButton)
c8000995
RD
129 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
130
131
132The wx.Menu methods that add items to a wx.Menu have been modified
133such that they return a reference to the wx.MenuItem that was created.
134Additionally menu items and toolbar items have been modified to
135automatically generate a new ID if -1 is given, similar to using -1
136with window classess. This means that you can create menu or toolbar
137items and event bindings without having to predefine a unique menu ID,
138although you still can use IDs just like before if you want. For
e8a71fa0
RD
139example, these are all equivallent other than their specific ID
140values::
c8000995
RD
141
142 1.
143 item = menu.Append(-1, "E&xit", "Terminate the App")
144 self.Bind(wx.EVT_MENU, self.OnExit, item)
145
146 2.
147 item = menu.Append(wx.ID_EXIT, "E&xit", "Terminate the App")
148 self.Bind(wx.EVT_MENU, self.OnExit, item)
d14a1e28 149
c8000995
RD
150 3.
151 menu.Append(wx.ID_EXIT, "E&xit", "Terminate the App")
152 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
153
154
d14a1e28
RD
155If you create your own custom event types and EVT_* functions, and you
156want to be able to use them with the Bind method above then you should
d7403ad2 157change your EVT_* to be an instance of wx.PyEventBinder instead of a
29bfe46b 158function. For example, if you used to have something like this::
d14a1e28
RD
159
160 myCustomEventType = wxNewEventType()
161 def EVT_MY_CUSTOM_EVENT(win, id, func):
162 win.Connect(id, -1, myCustomEventType, func)
163
164
165Change it like so::
166
6158f936
RD
167 myCustomEventType = wx.NewEventType()
168 EVT_MY_CUSTOM_EVENT = wx.PyEventBinder(myCustomEventType, 1)
d14a1e28
RD
169
170The second parameter is an integer in [0, 1, 2] that specifies the
171number of IDs that are needed to be passed to Connect.
172
d7403ad2
RD
173**[Changed in 2.5.1.6]** There is also an Unbind method added to
174wx.EvtHandler that can be used to disconenct event handlers. It looks
175like this::
176
177 def Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
178 """
179 Disconencts the event handler binding for event from self.
180 Returns True if successful.
181 """
d14a1e28
RD
182
183
c8000995
RD
184
185
d14a1e28
RD
186The wx Namespace
187----------------
188
189The second phase of the wx Namespace Transition has begun. That means
190that 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
192wx. There is still a Python package named wxPython with modules
193that have the names with the wx prefix for backwards compatibility.
194Instead of dynamically changing the names at module load time like in
1952.4, the compatibility modules are generated at build time and contain
196assignment statements like this::
197
d7403ad2 198 wxWindow = wx._core.Window
d14a1e28 199
d7403ad2 200Don't let the "_core" in the name bother you. That and some other
d14a1e28
RD
201modules are implementation details, and everything that was in the
202wxPython.wx module before will still be in the wx package namespace
d7403ad2
RD
203after this change. So from your code you would use it as wx.Window or
204wxWindow if you import from the wxPython.wx module.
d14a1e28
RD
205
206A few notes about how all of this was accomplished might be
207interesting... SWIG is now run twice for each module that it is
208generating code for. The first time it outputs an XML representaion
209of the parse tree, which can be up to 20MB and 300K lines in size!
210That XML is then run through a little Python script that creates a
211file full of SWIG %rename directives that take the wx off of the
212names, and also generates the Python compatibility file described
213above that puts the wx back on the names. SWIG is then run a second
214time to generate the C++ code to implement the extension module, and
215uses the %rename directives that were generated in the first step.
216
217Not every name is handled correctly (but the bulk of them are) and so
218some work has to be done by hand, especially for the reverse-renamers.
219So expect a few flaws here and there until everything gets sorted out.
220
221In summary, the wx package and names without the "wx" prefix are now
222the official form of the wxPython classes. For example::
223
224 import wx
225
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)
232
233 def JustDoIt(self, evt):
234 print "It's done!"
235
236 app = wx.PySimpleApp()
237 f = MyFrame(None, "What's up?")
238 f.Show()
239 app.MainLoop()
240
241You shouldn't need to migrate all your modules over to use the new
242package and names right away as there are modules in place that try to
243provide as much backwards compatibility of the names as possible. If
82a074ce 244you rewrote the above sample using "from wxPython.wx import * ", the
d14a1e28
RD
245old wxNames, and the old style of event binding it will still work
246just fine.
247
248
249
250
251New wx.DC Methods
252-----------------
253
d7403ad2
RD
254**[Changed in 2.5.1.6]** In wxPython 2.5.1.5 there was a new
255implementation of the wx.DC Draw and other methods that broke
256backwards compatibility in the name of consistency. That change has
257been reverted and the wx.DC Draw methods with 2.4 compatible
258signatures have been restored. In addition a new set of methods have
259been added that take wx.Point and/or wx.Size parameters instead of
260separate integer parameters. The Draw and etc. methods now available
261are::
d14a1e28 262
d14a1e28 263
d7403ad2
RD
264 FloodFill(x, y, colour, style = wx.FLOOD_SURFACE)
265 FoodFillPoint(pt, colour, style = wx.FLOOD_SURFACE)
d14a1e28 266
d7403ad2
RD
267 GetPixel(x,y)
268 GetPixelPoint(pt)
269
270 DrawLine(x1, y1, x2, y2)
271 DrawLinePoint(pt1, pt2)
d14a1e28 272
d7403ad2
RD
273 CrossHair(x, y)
274 CrossHairPoint(pt)
d14a1e28 275
d7403ad2
RD
276 DrawArc(x1, y1, x2, y2, xc, yc)
277 DrawArcPoint(pt1, pt2, centre)
d14a1e28 278
d7403ad2
RD
279 DrawCheckMark(x, y, width, height)
280 DrawCheckMarkRect(rect)
d14a1e28 281
d7403ad2
RD
282 DrawEllipticArc(x, y, w, h, sa, ea)
283 DrawEllipticArcPointSize(pt, sz, sa, ea)
d14a1e28 284
d7403ad2
RD
285 DrawPoint(x, y)
286 DrawPointPoint(pt)
d14a1e28 287
d7403ad2 288 DrawRectangle(x, y, width, height)
d14a1e28 289 DrawRectangleRect(rect)
d7403ad2 290 DrawRectanglePointSize(pt, sz)
d14a1e28 291
d7403ad2
RD
292 DrawRoundedRectangle(x, y, width, height, radius)
293 DrawRoundedRectangleRect(r, radius)
294 DrawRoundedRectanglePointSize(pt, sz, radius)
d14a1e28 295
d7403ad2
RD
296 DrawCircle(x, y, radius)
297 DrawCirclePoint(pt, radius)
d14a1e28 298
d7403ad2 299 DrawEllipse(x, y, width, height)
d14a1e28 300 DrawEllipseRect(rect)
d7403ad2 301 DrawEllipsePointSize(pt, sz)
d14a1e28 302
d7403ad2
RD
303 DrawIcon(icon, x, y)
304 DrawIconPoint(icon, pt)
d14a1e28 305
d7403ad2
RD
306 DrawBitmap(bmp, x, y, useMask = False)
307 DrawBitmapPoint(bmp, pt, useMask = False)
d14a1e28 308
d7403ad2
RD
309 DrawText(text, x, y)
310 DrawTextPoint(text, pt)
d14a1e28 311
d7403ad2
RD
312 DrawRotatedText(text, x, y, angle)
313 DrawRotatedTextPoint(text, pt, angle)
d14a1e28 314
d7403ad2
RD
315 bool Blit(xdest, ydest, width, height, sourceDC, xsrc, ysrc,
316 rop = wx.COPY, useMask = False, xsrcMask = -1, ysrcMask = -1)
317 BlitPointSize(destPt, sz, sourceDC, srcPt, rop = wx.COPY,
318 useMask = False, srcPtMask = wxDefaultPosition)
4da6d35e 319
d14a1e28 320
d7403ad2
RD
321 SetClippingRegion(x, y, width, height)
322 SetClippingRegionPointSize(pt, sz)
323 SetClippingRegionAsRegion(region)
324 SetClippingRect(rect)
d14a1e28 325
d14a1e28
RD
326
327
328
329
330Building, Extending and Embedding wxPython
331------------------------------------------
332
333wxPython's setup.py script now expects to use existing libraries for
334the contribs (gizmos, stc, xrc, etc.) rather than building local
335copies of them. If you build your own copies of wxPython please be
336aware that you now need to also build the ogl, stc, xrc, and gizmos
29bfe46b 337libraries in addition to the main wx lib.
d14a1e28
RD
338
339The wxPython.h and other header files are now in
9ec83f8d
RD
340.../wxPython/include/wx/wxPython instead of in wxPython/src. You
341should include it via the "wx/wxPython/wxPython.h" path and add
29bfe46b
RD
342.../wxPython/include to your list of include paths. On OSX and
343unix-like systems the wxPython headers are installed to the same place
9ec83f8d
RD
344that the wxWidgets headers are installed, so if you are building
345wxPython compatible extensions on those platforms then your include
346path should already be set properly.
29bfe46b
RD
347
348If you are also using SWIG for your extension then you'll need to
349adapt how the wxPython .i files are imported into your .i files. See
350the wxPython sources for examples. Your modules will need to at least
351``%import core.i``, and possibly others if you need the definition of
9ec83f8d
RD
352other classes. Since you will need them to build your modules using
353SWIG, the main wxPython .i files are also installed with the wxPython
354headers 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.
29bfe46b
RD
356
357The bulk of wxPython's setup.py has been moved to another module,
358wx/build/config.py. This module will be installed as part of wxPython
359so 3rd party modules that wish to use the same setup/configuration
360code can do so simply by importing this module from their own setup.py
361scripts using ``import wx.build.config``.
d14a1e28
RD
362
363You no longer need to call wxClassInfo::CleanUpClasses() and
364wxClassInfo::InitializeClasses() in your extensions or when embedding
365wxPython.
366
29bfe46b
RD
367The usage of wxPyBeginAllowThreads and wxPyEndAllowThreads has changed
368slightly. wxPyBeginAllowThreads now returns a boolean value that must
369be passed to the coresponding wxPyEndAllowThreads function call. This
370is to help do the RightThing when calls to these two functions are
371nested, or if calls to external code in other extension modules that
372are wrapped in the standard Py_(BEGIN|END)_ALLOW_THERADS may result in
373wx event handlers being called (such as during the call to
374os.startfile.)
d14a1e28
RD
375
376
377
378Two (or Three!) Phase Create
379----------------------------
380
381If you use the Precreate/Create method of instantiating a window, (for
382example, to set an extended style flag, or for XRC handlers) then
383there is now a new method named PostCreate to help with transplanting
384the brain of the prewindow instance into the derived window instance.
385For example::
386
387 class MyDialog(wx.Dialog):
388 def __init__(self, parent, ID, title, pos, size, style):
389 pre = wx.PreDialog()
390 pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
391 pre.Create(parent, ID, title, pos, size, style)
392 self.PostCreate(pre)
393
394
395
396Sizers
397------
398
e6a5dac6 399The hack allowing the old "option" keyword parameter has been removed.
9ec83f8d 400If you use keyword args with w.xSizer Add, Insert, or Prepend methods
d7403ad2
RD
401then you will need to use the ``proportion`` name instead of
402``option``. (The ``proportion`` keyword was also allowed in 2.4.2.4.)
d14a1e28 403
29bfe46b 404When adding a spacer to a sizer you now need to use a wx.Size or a
d14a1e28 4052-integer sequence instead of separate width and height parameters.
d7403ad2
RD
406This was optionally allowed in 2.4, but now it is required. This
407allows for more consistency in how you add the various types of items
408to a sizer. The first parameter defines the item (instead of the
409possibily first two, depending on if you are doing a spacer or not,)
410and that item can either be a window, a sizer or a spacer (which can
411be a sequence or a wx.Size.) Removing the option for separate width
412and height parameters greatly simplified the wrapper code.
d14a1e28 413
29bfe46b 414The wx.GridBagSizer class (very similar to the RowColSizer in the
d14a1e28
RD
415library) has been added to C++ and wrapped for wxPython. It can also
416be used from XRC.
417
418You should not use AddWindow, AddSizer, AddSpacer (and similar for
419Insert, Prepend, and etc.) methods any longer. Just use Add and the
d7403ad2
RD
420wrappers will figure out what to do. **[Changed in 2.5.1.6]**
421AddWindow, AddSize, AddSpacer and etc. will now issue a
422DeprecationWarning.
d14a1e28 423
95fed4d8
RD
424**[Changed in 2.5.1.6]** wx.ADJUST_MINSIZE is now the default
425behaviour for window items in sizers. This means that the item's
ffcb969e
RD
426GetMinSize and/or GetBestSize will be called when calculating layout
427and the return value from that will be used for the minimum size. The
428wx.FIXED_MINSIZE flag was added that will cause the sizer to *not*
429call window methods to determine the new best size, instead the
430minsize that the window had when added to the sizer (or the size the
431window was created with) will always be used. When a window is added
432to a sizer it's initial size, if any, is set as the window's minimal
d7403ad2
RD
433size using SetSizeHints if there isn't already a minimal size. If you
434would like the sizer to use something other than the window's initial
435size as the minimum then you can give it a new minimum by calling its
436SetSizeHints method.
437
95fed4d8 438
d14a1e28 439
dd346b94
RD
440PlatformInfo
441------------
442
443Added wx.PlatformInfo which is a tuple containing strings that
444describe the platform and build options of wxPython. This lets you
445know more about the build than just the __WXPORT__ value that
446wx.Platform contains, such as if it is a GTK2 build. For example,
447instead of::
448
449 if wx.Platform == "__WXGTK__":
450 ...
451
452you should do this::
453
454 if "__WXGTK__" in wx.PlatformInfo:
455 ...
456
457and you can specifically check for a wxGTK2 build by looking for
458"gtk2" in wx.PlatformInfo. Unicode builds are also detectable this
459way. If there are any other platform/toolkit/build flags that make
460sense to add to this tuple please let me know.
461
462BTW, wx.Platform will probably be deprecated in the future.
463
464
d14a1e28 465
b7c75283
RD
466ActiveX
467-------
468
469Lindsay Mathieson's newest wxActiveX_ class has been wrapped into a new
470extension module called wx.activex. It is very generic and dynamic
471and should allow hosting of arbitray ActiveX controls within your
472wxPython apps. So far I've tested it with IE, PDF, and Flash
473controls, (and there are new samples in the demo and also library
474modules supporting these.)
475
476.. _wxActiveX: http://members.optusnet.com.au/~blackpaw1/wxactivex.html
477
478The new wx.activex module contains a bunch of code, but the most
479important things to look at are ActiveXWindow and ActiveXEvent.
480ActiveXWindow derives from wxWindow and the constructor accepts a
481CLSID for the ActiveX Control that should be created. (There is also
482a CLSID class that can convert from a progID or a CLSID String.) The
483ActiveXWindow class simply adds methods that allow you to query some
484of the TypeInfo exposed by the ActiveX object, and also to get/set
485properties or call methods by name. The Python implementation
486automatically handles converting parameters and return values to/from
487the types expected by the ActiveX code as specified by the TypeInfo,
488(just bool, integers, floating point, strings and None/Empty so far,
489but more can be handled later.)
490
491That's pretty much all there is to the class, as I mentioned before it
492is very generic and dynamic. Very little is hard-coded and everything
493that is done with the actual ActiveX control is done at runtime and
494referenced by property or method name. Since Python is such a dynamic
495language this is a very good match. I thought for a while about doing
496some Python black-magic and making the specific methods/properties of
497the actual ActiveX control "appear" at runtime, but then decided that
498it would be better and more understandable to do it via subclassing.
499So there is a utility class in wx.activex that given an existing
500ActiveXWindow instance can generate a .py module containing a derived
501class with real methods and properties that do the Right Thing to
502reflect those calls to the real ActiveX control. There is also a
503script/tool module named genaxmodule that given a CLSID or progID and
504a class name, will generate the module for you. There are a few
b098694c 505examples of the output of this tool in the wx.lib package, see
b7c75283
RD
506iewin.py, pdfwin.py and flashwin.py.
507
508Currently the genaxmodule tool will tweak some of the names it
509generates, but this can be controled if you would like to do it
510differently by deriving your own class from GernerateAXModule,
511overriding some methods and then using this class from a tool like
512genaxmodule. [TODO: make specifying a new class on genaxmodule's
513command-line possible.] The current default behavior is that any
514event names that start with "On" will have the "On" dropped, property
515names are converted to all lower case, and if any name is a Python
516keyword it will have an underscore appended to it. GernerateAXModule
517does it's best when generating the code in the new module, but it can
518only be as good as the TypeInfo data available from the ActiveX
519control so sometimes some tweaking will be needed. For example, the
520IE web browser control defines the Flags parameter of the Navigate2
521method as required, but MSDN says it is optional.
522
523It is intended that this new wx.activex module will replace both the
524older version of Lindsay's code available in iewin.IEHtmlWindow, and
525also the wx.lib.activexwraper module. Probably the biggest
b098694c 526differences you'll ecounter in migrating activexwrapper-based code
b7c75283
RD
527(besides events working better without causing deadlocks) is that
528events are no longer caught by overriding methods in your derived
529class. Instead ActiveXWindow uses the wx event system and you bind
530handlers for the ActiveX events exactly the same way you do for any wx
531event. There is just one extra step needed and that is creating an
532event ID from the ActiveX event name, and if you use the genaxmodule
533tool then this extra step will be handled for you there. For example,
534for the StatusTextChange event in the IE web browser control, this
535code is generated for you::
536
537 wxEVT_StatusTextChange = wx.activex.RegisterActiveXEvent('StatusTextChange')
538 EVT_StatusTextChange = wx.PyEventBinder(wxEVT_StatusTextChange, 1)
539
540and you would use it in your code like this::
541
542 self.Bind(iewin.EVT_StatusTextChange, self.UpdateStatusText, self.ie)
543
544When the event happens and your event handler function is called the
545event properties from the ActiveX control (if any) are converted to
546attributes of the event object passed to the handler. (Can you say
547'event' any more times in a single sentence? ;-) ) For example the
548StatusTextChange event will also send the text that should be put into
549the status line as an event parameter named "Text" and you can access
b098694c 550it your handlers as an attribute of the event object like this::
b7c75283
RD
551
552 def UpdateStatusText(self, evt):
553 self.SetStatusText(evt.Text)
554
b098694c
RD
555Usually these event object attributes should be considered read-only,
556but some will be defined by the TypeInfo as output parameters. In
557those cases if you modify the event object's attribute then that value
558will be returned to the ActiveX control. For example, to prevent a
559new window from being opened by the IE web browser control you can do
560this in the handler for the iewin.EVT_NewWindow2 event::
561
562 def OnNewWindow2(self, evt):
563 evt.Cancel = True
b7c75283 564
29bfe46b 565So how do you know what methods, events and properties that an ActiveX
b7c75283
RD
566control supports? There is a funciton in wx.activex named GetAXInfo
567that returns a printable summary of the TypeInfo from the ActiveX
568instance passed in. You can use this as an example of how to browse
569the TypeInfo provided, and there is also a copy of this function's
570output appended as a comment to the modules produced by the
571genaxmodule tool. Beyond that you'll need to consult the docs
572provided by the makers of the ActiveX control that you are using.
573
574
575
26779945
RD
576Obsolete Modules
577----------------
d14a1e28
RD
578
579Instead of over a dozen separate extension modules linked together
580into a single extension module, the "core" module is now just a few
581extensions that are linked independently, and then merged together
582later into the main namespace via Python code.
583
e6a5dac6
RD
584Because of the above and also because of the way the new SWIG works,
585the "internal" module names have changed, but you shouldn't have been
26779945
RD
586using them anyway so it shouldn't bother you. ;-) In case you were
587erroneously using them in 2.4, here are the internal extension modules
588no longer exist:
589
590 * clip_dnd
591 * cmndlgs
592 * controls
593 * controls2
594 * events
595 * filesys
596 * fonts
597 * frames
598 * gdi
599 * image
600 * mdi
601 * misc
602 * misc2
603 * printfw
604 * sizers
605 * stattool
606 * streams
607 * utils
608 * windows
609 * windows2
610 * windows3
611
612They have been replaced by the following, but please remember that
d7403ad2
RD
613these are just "implementation details" and you should really be using
614the objects in these modules only via the wx or wxPython.wx packages:
26779945
RD
615
616 * _core
617 * _gdi
618 * _windows
619 * _controls
620 * _misc
621
d14a1e28 622
e6a5dac6
RD
623The help module no longer exists and the classes therein are now part
624of the core module imported with wxPython.wx or the wx package.
d14a1e28 625
26779945
RD
626
627
628
629Other Stuff
630-----------
631
d14a1e28
RD
632wxPyDefaultPosition and wxPyDefaultSize are gone. Use the
633wxDefaultPosition and wxDefaultSize objects instead.
634
635Similarly, the wxSystemSettings backwards compatibiility aliases for
636GetSystemColour, GetSystemFont and GetSystemMetric have also gone into
637the bit-bucket. Use GetColour, GetFont and GetMetric instead.
638
c878ceea
RD
639Use the Python True/False constants instead of the true, TRUE, false,
640FALSE that used to be provided with wxPython.
641
642Use None instead of the ancient and should have been removed a long
643time ago wx.NULL alias.
644
d7403ad2
RD
645wx.TreeCtrl.GetFirstChild no longer needs to be passed the cookie
646variable as the 2nd parameter. It still returns it though, for use
647with GetNextChild.
d14a1e28 648
ed8e1ecb
RD
649The wx.NO_FULL_REPAINT_ON_RESIZE style is now the default style for
650all windows. The name still exists for compatibility, but it is set
651to zero. If you want to disable the setting (so it matches the old
652default) then you need to use the new wx.FULL_REPAINT_ON_RESIZE style
653flag otherwise only the freshly exposed areas of the window will be
654refreshed.
d14a1e28 655
1f9b31fc
RD
656wxPyTypeCast has been removed. Since we've had the OOR (Original
657Object Return) for a couple years now there should be no need to use
658wxPyTypeCast at all.
d14a1e28 659
e6a5dac6
RD
660If you use the old wxPython package and wxPython.wx namespace then
661there are compatibility aliases for much of the above items.
78862f24
RD
662
663The wxWave class has been renamed to wxSound, and now has a slightly
664different API.
ce32c85b 665
d7403ad2
RD
666wx.TaskbarIcon works on wxGTK-based platforms (for some window
667managers,) however you have to manage it a little bit more than you
668did before. Basically, the app will treat it like a top-level frame
669in that if the wx.TaskBarIcon still exists when all the frames are
670closed then the app will still not exit. You need to ensure that the
671wx.TaskBarIcon is destroyed when your last Frame is closed. For
672wxPython apps it is usually enough if your main frame object holds the
673only reference to the wx.TaskBarIcon, then when the frame is closed
674Python reference counting takes care of the rest.
45d67f33 675
33ab916f
RD
676Before Python 2.3 it was possible to pass a floating point object as a
677parameter to a function that expected an integer, and the
678PyArg_ParseTuple family of functions would automatically convert to
679integer by truncating the fractional portion of the number. With
680Python 2.3 that behavior was deprecated and a deprecation warning is
681raised when you pass a floating point value, (for example, calling
d7403ad2 682wx.DC.DrawLine with floats for the position and size,) and lots of
33ab916f
RD
683developers using wxPython had to scramble to change their code to call
684int() before calling wxPython methods. Recent changes in SWIG have
685moved the conversion out of PyArg_ParseTuple to custom code that SWIG
686generates. Since the default conversion fragment was a little too
687strict and didn't generate a very meaningful exception when it failed,
688I decided to use a custom fragment instead, and it turned out that
689it's very easy to allow floats to be converted again just like they
690used to be. So, in a nutshell, any numeric type that can be
691converted to an integer is now legal to be passed to SWIG wrapped
692functions in wxPython for parameters that are expecting an integer.
693If the object is not already an integer then it will be asked to
694convert itself to one. A similar conversion fragment is in place for
695parameters that expect floating point values.
c878ceea
RD
696
697**[Changed in 2.5.1.6]** The MaskedEditCtrl modules have been moved
698to their own sub-package, wx.lib.masked. See the docstrings and demo
699for changes in capabilities, usage, etc.
700
d7403ad2
RD
701**[Changed in 2.5.1.6]** wx.MaskColour constructor has been deprecated
702and will raise a DeprecationWarning if used. The main wx.Mask
703constructor has been modified to be compatible with wx.MaskColour so
704you should use it instead.