Steven D'Aprano wrote:
> What do you mean, "objects are saved in another object"? > doc.py has a dictionary. When the user describes a wall, it is passed to the doc object to be saved in the dictionary. > > What happens if the user launches appwin with a different argument? > > If appwin can only take one, compulsory, argument, then it's silly to > require it as an argument. Just have appwin automatically import user.py, > and do whatever it needs. > I guess my description does not come across well. I thought user.py sounded like it is, a user created file. It will be named differently for each user to created different types of 3D objects. It does not make sense to expect every user to name their design file the same. So there will have to be a differently named single argument for buildeswin. > > This makes no sense to me. Are you saying that appwin opens a text editor > that allows the user to edit the user.py source code? > No. appwin opens an opengl (pyglet.window.Window()) graphics window as I mentioned. > > I don't know. How does user.py create the objects? Suppose it users a > function called "create". Then you would do this in appwin: > > > import user > user.create() > I have tried importing "user.py" and/or "app.py". However there is no single command to call. My program is designed to assist in the building design process. It is a big program and the creation of building components takes quite a few steps. I do not want to support these steps in a graphics window which is why the user uses any text editor they prefer to create "user.py". I want "appwin.py" (which has a graphics window) to be able to access objects stored in "doc.py" (which has a dictionary) after a command like "python user.py" so that the objects saved in "doc.py" after execution can be retrieved and drawn in "appwin.py". > What do you mean by "view() is encounted"? > This is a command that the user can enter in user.py. app.py will then encounter this command as python parses the file. > How would you access the objects stored in doc.py? Suppose you access > them using a list called "list_of_objects". Then in appwin.py: > > import doc > for obj in doc.list_of_objects: > do_something_with(obj) > I have tried this but there are no objects found in the dictionary in doc.py. I am guessing that I have to execute appwin.py so that it shares the same namespace with user.py or maybe a way to access that namespace. This is the reason for my question. > where you have to write the function "do_something_with", to do whatever > it is you want to do. > > > -- Kene :::::::::::::::::: kemen...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list