[BangPypers] how to handle attribute access

Nitin Kumar nitin.nitp at gmail.com
Sat Jul 31 21:20:27 CEST 2010


Hi,

I am working on automating some application. In one window say i have two
ComboBox, but that window have scroll bar. Only one combo Box is visible at
one time.

I have functions to handle scroll of window.

What i want is that how to handle attributes so that one i want to set some
value in the combobox which is not visible, then first that scroll function
is called then the comboBox will do what ever is required.

I will try to explain using one example.

class window:
      def __init__(self):
           self.CB1 = cbObject                    #CB1 is one combobox
object (to do different task on Combo Box)
                                                            #this is visible
once scroll bar on top
           self.CB2 = cbObject                    #CB1 is 2nd combobox
object (to do different task on Combo Box)
                                                            #this is visible
once scroll bar on bottom

    def scroll Up(self):
           ......................
    def scrollBottom(self):
           ......................

    #these above two functions can be used to scroll up and down.

use:

w=window()
w.CB1.Select(val)

w.CB2.Select(val)

Now to set value in wnd comboBox in need to scroll down first. This thing i
want to handle in class. Can i use metaclass (i dont know much about this)
or __getattr__ for the same.

point to note:
CB1 or CB2 are objects not functions. So i don't know if I can over load
that to achieve the purpose.

Thanks
Nitin K


More information about the BangPypers mailing list