The error that seemingly does nothing but loudly complain.
Traceback (most recent call last):
File "C:\Python\workbench\2D_astrophysics.py", line 33, in <module>
class func(object):
File "C:\Python\workbench\2D_astrophysics.py", line 53, in func
def set_attractor(self, val = self.G):
NameError: name 'self' is not defined
What code it's complaining about.
import math
from graphics import*
class UI(object):
def makeWin(self):
self.win = GraphWin("Vectors", 512, 512)
self.win.setBackground("black")
def closeWin(self):
self.win.close()
class func(object):
def __init__(self):
self.G = 6.67384*(10**-11)
def set_foo(self, foo):
self.foo = foo
def get_foo(self):
return self.foo
def set_bar(self, bar):
self.bar = bar
def get_bar(self):
return self.bar
...
...
...
def set_attractor(self, val = self.G):
self.G_const = val
def get_attractor(self):
return self.G_const
...
...
...
[edit:]
Actually, it does halt the second class from being operated upon.
>>> x = UI()
>>> y = func()
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
y = func()
NameError: name 'func' is not defined
>>>
This post has been edited by BloodyInari: 28 January 2013 - 04:21 PM

New Topic/Question
Reply




MultiQuote




|