Referencing frame widgets in another class

Hi everyone. I tried posting this question to the gmane newsgroup, but
it's been a while and I don't see it, so it might not be working for
me. I apologize if it appears twice.

My question was about referencing the widgets of my frame from within
a separate class, specifically a validator class. I've tried passing
the frame as an argument to the validator's __init__ method, but I get
an error saying there are too many arguments.

I know this is a very newbie OO question, but I just can't figure it
out! I'm trying to make some kind of reference like this in my
validator class:

frame.widget.method() = some_value

but so far I can't figure out how to get a reference to the frame.

Thanks.

Hi everyone. I tried posting this question to the gmane newsgroup, but
it’s been a while and I don’t see it, so it might not be working for
me. I apologize if it appears twice.

My question was about referencing the widgets of my frame from within

a separate class, specifically a validator class. I’ve tried passing
the frame as an argument to the validator’s init method, but I get
an error saying there are too many arguments.

well, just clue the frame to the validator after you create the validator like this

validator.frame = yourCustomFrame

I know this is a very newbie OO question, but I just can’t figure it

out! I’m trying to make some kind of reference like this in my
validator class:

frame.widget.method() = some_value

this look wrong, I think you wanted to say

some_variable = validator.frame.widget.method
()

···

On 8/3/06, John Salerno johnjsal@gmail.com wrote:

but so far I can’t figure out how to get a reference to the frame.

Thanks.


There is NO FATE, we are the creators.

Hi John,

John Salerno wrote:

Hi everyone. I tried posting this question to the gmane newsgroup, but
it's been a while and I don't see it, so it might not be working for
me. I apologize if it appears twice.

My question was about referencing the widgets of my frame from within
a separate class, specifically a validator class. I've tried passing
the frame as an argument to the validator's __init__ method, but I get
an error saying there are too many arguments.

I know this is a very newbie OO question, but I just can't figure it
out! I'm trying to make some kind of reference like this in my
validator class:

frame.widget.method() = some_value

but so far I can't figure out how to get a reference to the frame.

I use validators to make controls data aware and for this I need to pass some things to it, which I do like this:

        self.remarks.SetValidator(validators.valTC(dbParent = self,
                                                   dbItemName = 'dbItemImage',
                                                   dbCol = 'remarks'))

And this is part of the valTC validator:

class valTC(wx.PyValidator):
    """ Validator for standard TextCtrl to get/write data from an ORM
    datasource to/from the Window.
    """
    def __init__(self, dbParent, dbItemName = '', dbCol=None):
        """dbParent = has to have a dbItem attribute which is a
        ORM select item (a class in beans.py)
        dbItemName is an optional string with an alternative dbItem
        dbCol = database column name
        """
        wx.PyValidator.__init__(self)

        self.dbParent = dbParent
        self.dbItemName = dbItemName
        self.dbCol = dbCol

    def Clone(self):
        """Clone function, as the name implies creates a clone of this
        validator for each instance, make sure to pass the appropriate
        parameters.
        """
        return valTC(self.dbParent, self.dbItemName, self.dbCol)

Werner