Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40941

Re: Running external module and accessing the created objects

From Kene Meniru <Kene.Meniru@illom.org>
Subject Re: Running external module and accessing the created objects
Followup-To gmane.comp.python.general
Date 2013-03-09 06:05 -0500
Organization illom.org
References <mailman.3110.1362798411.2939.python-list@python.org> <513aecd3$0$6512$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.3123.1362827170.2939.python-list@python.org> (permalink)

Followups directed to: gmane.comp.python.general

Show all headers | View raw


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
::::::::::::::::::
KeMeniru@gmail.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Running external module and accessing the created objects  Kene Meniru <Kene.Meniru@illom.org> - 2013-03-08 22:06 -0500
  Re: Running external module and accessing the created objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-09 08:03 +0000
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 06:05 -0500
      Re: Running external module and accessing the created objects Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-09 11:34 +0000
    Re: Running external module and accessing the created objects Chris Angelico <rosuav@gmail.com> - 2013-03-09 22:47 +1100
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-09 07:02 -0500
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 10:34 -0500
      Re: Running external module and accessing the created objects Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-09 08:51 -0800
        Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 12:21 -0500
          Re: Running external module and accessing the created objects Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-09 10:33 -0800
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-09 11:12 -0500
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 11:56 -0500
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-09 12:20 -0500
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 12:39 -0500
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-09 13:18 -0500
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-11 19:57 -0400
      Re: Running external module and accessing the created objects Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-11 23:40 -0700
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-11 20:48 -0400
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-11 21:23 -0400
    Re: Running external module and accessing the created objects Kene Meniru <Kene.Meniru@illom.org> - 2013-03-11 21:58 -0400
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-11 22:16 -0400
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-11 22:11 -0400
    Re: Running external module and accessing the created objects Michael Torrie <torriem@gmail.com> - 2013-03-11 22:05 -0600
    Re: Running external module and accessing the created objects Dave Angel <davea@davea.name> - 2013-03-12 07:20 -0400
    Re: Running external module and accessing the created objects Kene Meniru <kemeniru@gmail.com> - 2013-03-12 13:38 +0000
    Re: Running external module and accessing the created objects Kene Meniru <kemeniru@gmail.com> - 2013-03-12 13:28 +0000

csiph-web