Frame Editor error...

Help
Alex S
2010-01-27
2013-05-01
  • Alex S
    Alex S
    2010-01-27

    Hi there,
    I've made a program that involves a main frame and then a dialog frame to display and change some parameters (18 in all).  I made it and it seems to work fine, but now when I go to try and edit the frame further with frame designer, an error pops up:

    NameError: name 'k_Low' is not defined

    k_Low being one of the parameters passed to the dialog from main frame.  Does anyone know if there's a way to salvage this or am I best just remaking the dialog?  I'm afraid of remaking it and it happening again, driving me to inevitable madness.

    A thought - I initialized the names of all the parameters in the init_ctrls method.  That is I went into them and said "value = k_Low" or whatever.  Should I have not done that?  ie I ignored the "generated method, don't edit" tag.  Instead should I have used something like self.kLow.SetLabel() method outside of the init_ctrls bit?

     
  • Hi,

    Editing the generated method can cause problems if you do not respect what Boa expects.

    I believe what you want to do is something like this:

    Change:
    self.button1 = wx.Button(id=wxID_ATTRMIXINFRAMEBUTTON1,
                  label='somelabel', name='button1', parent=self,
                  pos=wx.Point(0, 0), size=wx.Size(193, 77), style=0)

    to:
    self.button1 = wx.Button(id=wxID_ATTRMIXINFRAMEBUTTON1,
                  label=self.buttonLabel, name='button1', parent=self,
                  pos=wx.Point(0, 0), size=wx.Size(193, 77), style=0)

    If this is what you want to do then you should look at boa\examples\advanced\attrMixins

    Werner

     
  • Alex S
    Alex S
    2010-01-28

    Ok, thanks a lot.  I think that's what I was trying to do, but I found it does what I want and doesn't screw things up if I just have default labels in 'init_ctrls' and then set them all with the setvalue() command in the __init__ part (after calling init_ctrls).

    Thanks again!
    Alex