[Pygui] Button Action method raises error in Actions.py: Fn takes 5 args (1 given)

Matthew Versaggi profversaggi at gmail.com
Sun Jan 24 23:09:50 EST 2016


Dear PyGUI members,


I've run into a showstopper with PyGUI and hope to find a way around it or
else I'll have to abandon the framework altogether.

I'm *importing *(many) modules into the GUI framework, one of which I
invoke via the *action *keyword for a simple button. I do a quick define of
a wrapper function in PyGUI and there call my imported module. This module
takes *ONE *argument (a string), however the error message I get is that it
takes *FIVE *arguments. This is not true and is a bug in the PyGUI system.

Here is my traceback:

Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\GUI\WinUtils.py", line 93, in
OnCommand
    self._forward_reflected_message(lParam, name)
  File "C:\Anaconda\lib\site-packages\GUI\WinUtils.py", line 103, in
_forward_reflected_message
    meth(*args)
  File "C:\Anaconda\lib\site-packages\GUI\Button.py", line 58, in
_win_bn_clicked
    self.do_action()
  File "C:\Anaconda\lib\site-packages\GUI\*Actions.py*", line* 61*, in
do_action
    self.do_named_action('action')
  File "C:\Anaconda\lib\site-packages\GUI\*Actions.py*", *line 46*, in
do_named_action
    raise et, et("%s (while doing action %r%r)" % (ev, action, args)), tb
TypeError: *function takes exactly 5 arguments (1 given)*



For extremely simple functions of my imports, this works fine, but for more
complicated ones, this fails.

I'm using Anaconda Python 2.7.10 if that helps.



This is the PyGUI Function in question, the offending line is in bold....

class ActionBase(object):
    """Mixin class providing base support for action properties."""

    def do_named_action(self, name):
        #print "ActionBase.do_named_action:", repr(name) ###
        action = getattr(self, name)
        #print "...action =", repr(action) ###
        if action:
            try:
                if isinstance(action, tuple):
                    args = action[1:]
                    action = action[0]
                else:
                    args = ()
                if isinstance(action, str):
                    #print "...handling", action ###
                    self.handle(action, *args)
                else:
                    action(*args)
            except ApplicationError:
                raise
            except:
                import sys
                et, ev, tb = sys.exc_info()
                *raise et, et("%s (while doing action %r%r)" % (ev, action,
args)), tb*



I would appreciate any insights into a fix, workaround, alteration,
something - this is a showstopper for using this framework if I can't get
an imported method to operate.


Thanks very much for your time in advance...

-matt


-- 
#########################################################
Matthew R. Versaggi,
Artificial Intelligence Engineer, Imagine One, LTD
President & CEO: Versaggi Information Systems, Inc.
Adjunct Professor of eBusiness DePaul University
Email: mailto:matt at versaggi.com, ProfVersaggi at gmail.com
M: 630-292-8422
LinkedIn:  http://www.linkedin.com/in/versaggi
About Me: http://www.matt-versaggi.com/resume/
#########################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20160124/391b108f/attachment.html>


More information about the Pygui mailing list