X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed8e1ecb3fdabbbe5062ebba2a50a2bc8d1e2c76..e6477984b100047f1d4f4f6049d51d4829712fea:/wxPython/docs/MigrationGuide.txt?ds=sidebyside diff --git a/wxPython/docs/MigrationGuide.txt b/wxPython/docs/MigrationGuide.txt index 0beb368428..bb274019e0 100644 --- a/wxPython/docs/MigrationGuide.txt +++ b/wxPython/docs/MigrationGuide.txt @@ -27,9 +27,9 @@ now be the GUI thread instead of the one that imports wxPython. Some potential problems are that the C++ side of the "stock-objects" (wx.BLUE_PEN, wx.TheColourDatabase, etc.) are not initialized until the wx.App object is created, so you should not use them until after -you have created your wx.App object. (In fact, until I find a better -solution trying to use one of the stock objects before the app is -created will probably result in a crash.) +you have created your wx.App object. If you do then an exception will +be raised telling you that the C++ object has not bene initialized +yet. Also, you will probably not be able to do any kind of GUI or bitmap operation unless you first have created an app object, (even on @@ -124,8 +124,8 @@ function. If you used to have something like this:: Change it like so:: - myCustomEventType = wxNewEventType() - EVT_MY_CUSTOM_EVENT = wxPyEventBinder(myCustomEventType, 1) + myCustomEventType = wx.NewEventType() + EVT_MY_CUSTOM_EVENT = wx.PyEventBinder(myCustomEventType, 1) The second parameter is an integer in [0, 1, 2] that specifies the number of IDs that are needed to be passed to Connect. @@ -189,7 +189,7 @@ the official form of the wxPython classes. For example:: You shouldn't need to migrate all your modules over to use the new package and names right away as there are modules in place that try to provide as much backwards compatibility of the names as possible. If -you rewrote the above sample using "from wxPython.wx import *", the +you rewrote the above sample using "from wxPython.wx import * ", the old wxNames, and the old style of event binding it will still work just fine. @@ -275,19 +275,20 @@ that are affected are listed here:: Blit(destPt, size, sourceDC, srcPt, rop = wxCOPY, useMask = FALSE, srcPtMask = wx.DefaultPosition) - SetClippingRegionXY SetClippingRegion(x, y, width, height) + SetClippingRegionXY(x, y, width, height) SetClippingRegion(point, size) SetClippingRect(rect) SetClippingRegionAsRegion(region); -If you have code that draws on a DC you **will** get errors because of -these changes, but it should be easy to fix the code. You can either -change the name of the *Type B* method called to the names shown -above, or just add parentheses around the parameters as needed to turn -them into tuples and let the SWIG typemaps turn them into the wx.Point -or wx.Size object that is expected. Then you will be calling the new -*Type A* method. For example, if you had this code before:: +If you have code that draws on a DC and you are using the new wx +namespace then you **will** get errors because of these changes, but +it should be easy to fix the code. You can either change the name of +the *Type B* method called to the names shown above, or just add +parentheses around the parameters as needed to turn them into tuples +and let the SWIG typemaps turn them into the wx.Point or wx.Size +object that is expected. Then you will be calling the new *Type A* +method. For example, if you had this code before:: dc.DrawRectangle(x, y, width, height) @@ -305,6 +306,14 @@ Then you can just simplify it like this:: dc.DrawRectangle(p, s) +Now before you start yelling and screaming at me for breaking all your +code, take note that I said above "...using the new wx namespace..." +That's because if you are still importing from wxPython.wx then there +are some classes defined there with Draw and etc. methods that have +2.4 compatible signatures. However if/when the old wxPython.wx +namespace is removed then these classes will be removed too so you +should plam on migrating to the new namespace and new DC Draw methods +before that time. @@ -401,4 +410,7 @@ default) then you need to use the new wx.FULL_REPAINT_ON_RESIZE style flag otherwise only the freshly exposed areas of the window will be refreshed. +wxPyTypeCast has been removed. Since we've had the OOR (Original +Object Return) for a couple years now there should be no need to use +wxPyTypeCast at all.