What I am trying to do is in my Button onHit method I am trying to
pass the self dForm to my python code called MyCode.py . In MyCode.py
has one function called setQuickButtons( self ).  In setQuickButtons()
all I am doing is changing the Button1,Caption = "ORDER" and then
refresh() the button.  Later on I will be dealing with all my Buttons to
change their caption colors and turning on an of the buttons. The code
in my little test is:

MyCode.py---------------------------------------------------------------------

def setQuickButtons( self ):
        print self.Form.QuickButton1.Caption
        self.Form.QuickButton1.Caption ="ORDER"
        self.Form.QuickButton1.FontBold = True
        self.Form.QuickButton1.refresh()

and in my ClassDesigner Form is:

Class Designer My Form
---------------------------------------------------------------

## *!* ## Dabo Code ID: dButton-dForm
def onHit(self, evt):
        import MyCode
        
        dabo.trace()
        setQuickButtons( self )
        self.Form.QuickButton1.Caption ="ORDER"
        self.Form.QuickButton1.FontBold = True
        self.Form.QuickButton1.refresh()

   I included in my onHit import MyCode that is located in ui folder.
When I run the code using the command window the output is:

 pdb debugger
----------------------------------------------------------------------
> /tmp/tmpbJqoFr.py(348)onHit()
-> setQuickButtons( self )
343                     
344                             def onHit(self, evt):
345                                     import MyCode
346                                     
347                                     dabo.trace()
348  ->                                 setQuickButtons( self )
349                                     self.Form.QuickButton1.Caption ="ORDER"
350                                     self.Form.QuickButton1.FontBold = True
351                                     self.Form.QuickButton1.refresh()

NameError: "global name 'setQuickButtons' is not defined"
> /tmp/tmpbJqoFr.py(348)onHit()
-> setQuickButtons( self )

  I don't understand the NameError when I have my import MyCode above my
setQuickButtons?  Any Ideas and is my idea about passing self into
MyCode.py correct?

Bob




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to