On Mon, Jan 23, 2012 at 4:57 PM, Ian Kelly 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 frame?
>
I
On Mon, Jan 23, 2012 at 3:45 PM, Jonno 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 app
> is created.
Yea
On Mon, Jan 23, 2012 at 4:20 PM, Ian Kelly 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 v.1310 32 bit
> (I
On Mon, Jan 23, 2012 at 2:52 PM, Jonno wrote:
> On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly 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
On Mon, Jan 23, 2012 at 3:42 PM, Ian Kelly 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 "app". All
On Mon, Jan 23, 2012 at 2:22 PM, Jonno 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 strong suspicion t
On Mon, Jan 23, 2012 at 4:22 PM, Jonno wrote:
>
>
> On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy 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 h
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 2:25 PM, Terry Reedy 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 inside an
On Mon, Jan 23, 2012 at 1:58 PM, MRAB 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' instance and then bin
On 23/01/2012 20:27, Jonno wrote:
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly mailto:ian.g.ke...@gmail.com>> wrote:
On Mon, Jan 23, 2012 at 12:44 PM, Jonno mailto:jonnojohn...@gmail.com>> wrote:
> I have a pretty complicated bit of code that I'm trying to
convert to more
> cle
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 r
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 convo
On Mon, Jan 23, 2012 at 2:09 PM, Ian Kelly wrote:
> On Mon, Jan 23, 2012 at 12:44 PM, Jonno 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 to rewrite the whole thing to get ri
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 convoluted
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 Mon, Jan 23, 2012 at 12:44 PM, Jonno 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 available inside anoth
On Mon, Jan 23, 2012 at 1: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 rath
18 matches
Mail list logo