-1
我想使散点平面布局行为如何我希望它,但是当我尝试缩小超过某个点时,我得到错误“RuntimeError:超过最大递归深度调用Python对象”我无法通过试错弄清楚为什么会发生递归,尽管我已经发现了它发生在哪里(它被标记代码)递归错误我找不出
这里是回溯:http://pastebin.com/i2z8SXgc
class Controller(ScatterPlaneLayout):
def __init__(self, **kwargs):
super(Controller, self).__init__(**kwargs)
def on_transform(self, instance, value):
win = self.get_parent_window().size
this = self.bbox[1]
if win[0] > this[0] and win[1] > this[1]:
if self.x < 0:
self.x = 0
if self.y < 0:
self.y = 0
if this[0] + self.x > win[0]:
self.set_right(win[0])
if this[1] + self.y > win[1]:
self.set_top(win[1])
else:
if self.x > 0:
self.x = 0
if self.y > 0:
self.y = 0
#This is the part that causes the error
if this[0] + self.x < win[0]:
self.x = win[0] - this[0]
#end of error
if this[1] + self.y < win[1]:
self.set_top(win[1])
将堆栈跟踪(重复的部分)放入 – AlbertFerras
欢迎使用StackOverflow。请阅读并遵循发布指南,尤其是[MCVE](http://stackoverflow.com/help/mcve)。为我们提供样本输入和输出(包括期望和您在编码尝试中获得的内容)。既然你知道问题出在哪里,如果你告诉我们,这会有所帮助。 – Prune
哎呀我以为我已经把它放在了,现在是这样,问题是,当我试图缩小超过某个点时它崩溃也错误标记在代码 –