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


Groups > comp.lang.python > #36034 > unrolled thread

Re: Can't seem to start on this

Started byMitya Sirenef <msirenef@lightbird.net>
First post2013-01-02 23:46 -0500
Last post2013-01-02 23:46 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Can't seem to start on this Mitya Sirenef <msirenef@lightbird.net> - 2013-01-02 23:46 -0500

#36034 — Re: Can't seem to start on this

FromMitya Sirenef <msirenef@lightbird.net>
Date2013-01-02 23:46 -0500
SubjectRe: Can't seem to start on this
Message-ID<mailman.17.1357188364.2939.python-list@python.org>
On 01/02/2013 11:32 PM, Kene Meniru wrote:
> This sounds so simple but being  new to python I am finding it hard to get
 > started. I want to create a module which I will call "B". There will be
 > other modules called "C", "D", etc, which will most likely be 
imported in
 > "B". Then I want the user to import "B" ONLY into another file I will 
call
 > "A" in which commands such as the following will be entered:
 >
 > snap_size = 10
 > LinearMark(name)
 > LinearMark.put(name, length, rotation, (x,y,z))
 >
 > The file "A" allows the user to enter commands that provide global 
variables
 > as well as to use classes provided in modules "C", "D", etc, in the 
manner
 > shown in the sample above. For example snap_size is a global setting.
 > LinearMark(name) creates a linear mark of the provided name.
 > LinearMark.put(...) places the LinearMark object using the provided
 > parameters, etc.
 >
 > How can I make this possible? I am guessing I have to instantiate the
 > classes in file "B" but typing LinearMark(name) in file "A" generates an
 > error. Eventually I will provide a gui but I want to separate usage 
so there
 > is no dependence on the gui to run this application.
 >
 > Please help.
 >
 >


Where is snap_size from? Where is LinearMark from? You don't need to
instantiate LinearMark in B, do it in A.

What error do you get when you instantiate LinearMark in A? Please
paste.

If LinearMark is imported in from C, you can do:

B.py
from C import LinearMark

A.py
from B import LinearMark

lmark = LinearMark(name)
lmark.put(...)

Or do you want to use class method of LinearMark?

Since you don't provide any code, it's really hard to tell what you're
doing....

  HTH, -m



-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web