ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[Tutor] Reuse of callback
by Vicki Stanfield other posts by this author
Dec 12 2003 6:15PM messages near this date
[Tutor] Re: Reuse of callback | =?ISO-8859-1?B?UmU6IFtUdXRvcl0gUGFyc2luZyBIVE1MIGZpbGU=?=
I have a function which is called via a button callback. I would like to
reuse this function based on the setting of a radio box button. The
existing function is like this:

    def Pass2ME(self,event):
        something()

and it is called by this:

    self.pass2mebutton = wxButton(self, 32, label= "Pass to ME",
                            style = wxBU_BOTTOM ,size=(150,20),
                            name = "Pass2ME")
    EVT_BUTTON(self, 32, self.Pass2ME)


now I want to call the same Pass2ME function from a toggle button if the
setting is ME. I have the code to create the radio box coded like this:

    self.MyController=wxRadioBox(self, 35, majorDimension = 1,
                                      choices=['UI','ME'],
                                      style= wxSUNKEN_BORDER |
                                      wxALIGN_BOTTOM|wxRB_SINGLE)
    EVT_RADIOBOX(self, 35, self.SetMyController)


self.SetMyController looks like this:

    def SetMyController(self,event):
        if event.GetString() == 'ME':
            Pass2ME(self, event)
        else:
            somethingelse()


I am getting an error due to the number of parameters passed to the
Pass2ME function.

The error is:

Traceback (most recent call last):
  File "F:\wxComTool9.5.py", line 2109, in ?
    frame=MyFrame(NULL, -1, "Communication Tool")
  File "F:\wxComTool9.5.py", line 2083, in __init__
    panel1 = ComboBoxPanel(self,-1, wxDefaultSize, style=wxSUNKEN_BORDER)
  File "F:\wxComTool9.5.py", line 98, in __init__
    style= wxSUNKEN_BORDER | wxALIGN_BOTTOM|wxRB_SINGLE)
  File "C:\Python23\Lib\site-packages\wxPython\controls.py", line 969, in
__init
__
    self.this = controlsc.new_wxRadioBox(*_args,**_kwargs)
TypeError: new_wxRadioBox() takes at least 3 arguments (2 given)
13:18:13: Debug: e:\Projects\wx2.4\src\msw\app.cpp(439):
'UnregisterClass(canvas
)' failed with error 0x00000584 (class still has open windows.).

Any help is greatly appreciated.

--vicki

_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved