AttributeError: 'Attributes' object has no attribute 'saveFile'

Discussion in 'Python' started by crystalattice, Sep 1, 2006.

  1. Not sure how to explain, but I'll try my best. I'm making a GUI with
    wxGlade. The GUI has windows that open when the "Next Page" button is
    pushed; the button also pickles the information that is input into the
    frame at the same time. The saveFile name is autocreated based on the
    data entered by the user in the first frame.

    Each frame that is created is a new class, e.g. the first frame that
    opens is "CharInfo", which opens the frame "Attributes". The pickling
    works for the first frame but doesn't work for the ones after.
    Apparently the saveFile attribute I created in the "CharInfo" class
    isn't carried through to "Attribures", even though it's supposed to be
    a subclass.

    I've tried several different ways to get it working, such as expressly
    calling CharInfo.saveFile, calling CharInfo.pushedButton.saveFile
    (saveFile is part of the pushedButton method), calling
    Attributes.saveFile, and calling self.saveFile. Every time, I get the
    AttributeError message stating saveFile is not an attribute of either
    the classes or any function.

    The reason I want to keep the same saveFile attribute through every
    class is because the initial button in CharInfo creates the file save
    name and path; I'd like to have it carried through the rest of the
    classes so each new frame will save it's information to the same file.

    Is there a way to keep the saveFile "live" throughout the entire
    program or would it be better to create a "choose a filename" window at
    the end of the program? If the latter, is there anything special I
    need to know so the information in each class is pickled correctly?
    crystalattice, Sep 1, 2006
    1. Advertisements

  2. crystalattice

    t.mitchell Guest


    Sounds like you've got a wizard-type interface thing happening.
    I haven't used wxGlade but I have done similar things in GTK several

    Try putting all the windows in a notebook widget with hidden tabs.
    Put the 'Next Page' button and the filename outside the notebook. This
    makes the filename always available and the 'Next Page' button would
    just switch pages in the notebook widget.

    Hope this is helpful

    t.mitchell, Sep 1, 2006
    1. Advertisements

  3. Sounds simple enough. Of course, we all know the difference between
    theory and practice. I think I rember seeing a wizard-type interface
    in the wxGlade tutorial. I'll take a look at that to. Thanks for the
    crystalattice, Sep 1, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.