Re: May be an issue in Phoenix ?
Robin Dunn <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > > Hello, > > > I work on W10 with py 3.5 and Phoenix 3.0.3 build 1964 > > > First) > > If I use 'ToolBar.AddTool (self, toolId, label, bitmap, shortHelp=””, > kind=ITEM_NORMAL)’ > > It runs well > > > But if I use ‘ToolBar.AddTool (self, toolId, label, bitmap, > bmpDisabled, kind=ITEM_NORMAL, shortHelpString=””, longHelpString=””, > clientData=None)’ like in doc > > I have a traceback : > > TypeError: ToolBar.AddTool(): arguments did not match any overloaded call: > > overload 1: 'kind' is not a valid keyword argument > > overload 2: 'shortHelpString' is not a valid keyword argument > > overload 3: 'kind' is not a valid keyword argument > I changed the Toolbar sample in the demo to add the same keyword args and it works fine for me. Compare your code to the demo and see what you are doing differently. Here is my test: diff --git a/demo/ToolBar.py b/demo/ToolBar.py index eeb56cc..d37fcd7 100644 --- a/demo/ToolBar.py +++ b/demo/ToolBar.py @@ -93,7 +93,12 @@ class TestToolBar(wx.Frame): tb.SetToolBitmapSize(tsize) #tb.AddTool(10, new_bmp, "New", "Long help for 'New'") - tb.AddTool(10, "New", new_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "New", "Long help for 'New'", None) + #tb.AddTool(10, "New", new_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "New", "Long help for 'New'", None) + tb.AddTool(10, "New", new_bmp, wx.NullBitmap, + kind=wx.ITEM_NORMAL, + shortHelpString="New", + longHelpString="Long help for 'New'", + clientData=None) self.Bind(wx.EVT_TOOL, self.OnToolClick, id=10) self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=10) > Second) > > If I use wx.html.H .SetPage() and wx.wxpTag > > With Arg > > '''<p> > > <wxp module="wx" class="StaticText"> > > <param name="label" value=" "> > > <param name="id" value="%d"> > > <param name="size" value="(352, 20)"> > > </wxp>’’’ > > It runs well > > > But with > > '''<p> > > <wxp module="wx" class="StaticText"> > > <param name="label" value=" "> > > <param name="id" value="%d"> > > <param name="size" value="(352, 20)"> > > <param name="style" value="wx.ALIGN_CENTER | wx.CLIP_CHILDREN | > wx.ST_NO_AUTORESIZE"> > > </wxp>’’’Traceback is : > > TypeError: StaticText(): arguments did not match any overloaded call: > > overload 1: too many arguments > > overload 2: argument 'style' has unexpected type 'str' > Use () in the value, like this: "(wx.ALIGN_CENTER | wx.CLIP_CHILDREN | wx.ST_NO_AUTORESIZE)" That will trigger an evaluation of the style names instead of using them as a string. > Third) > > Methods have ‘im_func’ attribute in wxPython (classic), so > > Do you know why methods in Phoenix (for py 3) have no ‘__func__’ > attribute ? > Because most functions and methods are now builtin functions (exported directly from C) and do not have a Python method wrapped around it. Classic: >>> wx.Frame.Close <unbound method Frame.Close> >>> f = wx.Frame(None) >>> f.Close.__class__ <type 'instancemethod'> Phoenix: >>> wx.Frame.Close <built-in function Close> >>> f = wx.Frame(None) >>> f.Close.__class__ <class 'builtin_function_or_method'> -- Robin Dunn Software Craftsman http://wxPython.org -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.