I have a pretty complicated bit of code that I'm trying to convert to more
clean OOP.
Without getting too heavy into the details I have an object which I am
trying to make available inside another class. The reference to the object
is rather long and convoluted but what I find is that within my
On Mon, Jan 23, 2012 at 1:44 PM, Jonno jonnojohn...@gmail.com wrote:
I have a pretty complicated bit of code that I'm trying to convert to more
clean OOP.
Without getting too heavy into the details I have an object which I am
trying to make available inside another class. The reference to
On Mon, Jan 23, 2012 at 12:44 PM, Jonno jonnojohn...@gmail.com wrote:
I have a pretty complicated bit of code that I'm trying to convert to more
clean OOP.
Then you probably should not be using globals.
Without getting too heavy into the details I have an object which I am
trying to make
On 01/23/2012 12:44 PM, Jonno wrote:
Any ideas why I can reference foo inside the method but not in __init__?
No idea, but could you pass foo as a constructor parameter to __init__
and store it as an instance variable?
--
http://mail.python.org/mailman/listinfo/python-list
On 1/23/2012 2:44 PM, Jonno wrote:
I have a pretty complicated bit of code that I'm trying to convert to
more clean OOP.
Without getting too heavy into the details I have an object which I am
trying to make available inside another class. The reference to the
object is rather long and
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jan 23, 2012 at 12:44 PM, Jonno jonnojohn...@gmail.com wrote:
I have a pretty complicated bit of code that I'm trying to convert to
more
clean OOP.
Then you probably should not be using globals.
I'm trying
On 01/23/2012 11:44 AM, Jonno wrote:
I have a pretty complicated bit of code that I'm trying to convert to
more clean OOP.
Without getting too heavy into the details I have an object which I am
trying to make available inside another class. The reference to the
object is rather long and
Gary Herron wrote:
If the method does not bind it, then Python will look in the class for
foo. This could work
class Class1:
foo = whatever # Available to all instances
def __init__(self):
foo.bar.object
self.foo.bar.object
^- needs the self
On 23/01/2012 20:27, Jonno wrote:
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly ian.g.ke...@gmail.com
mailto:ian.g.ke...@gmail.com wrote:
On Mon, Jan 23, 2012 at 12:44 PM, Jonno jonnojohn...@gmail.com
mailto:jonnojohn...@gmail.com wrote:
I have a pretty complicated bit of code that
On Mon, Jan 23, 2012 at 1:58 PM, MRAB pyt...@mrabarnett.plus.com wrote:
Either way would work but the main issue is I can't seem to use foo or
foo.bar or foo.bar.object anywhere in __init__ or even before that in
the main class area.
This line:
foo = MyApp(0)
will create a 'MyApp'
On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy tjre...@udel.edu wrote:
On 1/23/2012 2:44 PM, Jonno wrote:
I have a pretty complicated bit of code that I'm trying to convert to
more clean OOP.
Without getting too heavy into the details I have an object which I am
trying to make available
Script...
import wx
import wx.aui
import matplotlib as mpl
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
class Class1(wx.Panel):
def __init__(self, parent, id = -1, dpi = None, **kwargs):
wx.Panel.__init__(self, parent, id=id, **kwargs)
self.figure
On Mon, Jan 23, 2012 at 4:22 PM, Jonno jonnojohn...@gmail.com wrote:
On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy tjre...@udel.edu wrote:
On 1/23/2012 2:44 PM, Jonno wrote:
I have a pretty complicated bit of code that I'm trying to convert to
more clean OOP.
Without getting too heavy
On Mon, Jan 23, 2012 at 2:22 PM, Jonno jonnojohn...@gmail.com wrote:
References inside functions are resolved when the function is called. So
purely from what you have presented above, it would seem that 'foo' is
defined between the call to __init__ and a later call to method1.
I have a
On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
Exactly. The line app = MyApp(0) creates a MyApp instance and then
assigns it to app. As part of the MyApp creation process, it
creates a MyFrame, which creates a Tab, which creates a Class1, which
attempts to reference
On Mon, Jan 23, 2012 at 2:52 PM, Jonno jonnojohn...@gmail.com wrote:
On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
Exactly. The line app = MyApp(0) creates a MyApp instance and then
assigns it to app. As part of the MyApp creation process, it
creates a MyFrame,
On Mon, Jan 23, 2012 at 4:20 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
The App object is created and the wx framework already knows about it.
It's just not assigned to the app global yet, and the OnInit call has
not completed yet. See:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC
On Mon, Jan 23, 2012 at 3:45 PM, Jonno jonnojohn...@gmail.com wrote:
I see, so that would get me access to the app instance during init of Class1
but if I can't access frame or the object as they still aren't created yet.
I can only do that in attributes that I know won't be called until the
On Mon, Jan 23, 2012 at 4:57 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
By the way, looking at your object hierarchy more closely, isn't
app.frame.graph_panel going to end up being the same thing as just
self.figure? Why not just use the latter and remove the reliance on
finding the correct
19 matches
Mail list logo