- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
由于某些原因,执行以下代码行时,会出现错误说明:'car'对象没有属性'time_int'该类称为car。
尽管我将方法包括在同一个类中,但是每次尝试调用self.time_int
时,上面都会出现错误,这是代码片段:
# the __init__ also has the buttons that connect to other methods, but I just included the relevant one
class car:
def __init__(self,master):
self.helv = tkinter.font.Font(family ="Helvetica", size = 20, weight = 'bold')
self.master = master
master.title('RC car controls')
self.background_image = PhotoImage(file='1.gif') #upload background picture
self.background_label = Label(master, image=self.background_image)
self.background_label.image = self.background_image
self.background_label.place(x=0,y=0,relwidth=1, relheight=1) #placing of background picture
master.geometry("500x500")
master.resizable(0, 0)
self.acl = Button(master, command = lambda: [self.set_down(),self.set_up()], image = self.img,
padx = 4, pady = 4)
self.acl.place(relx = 0.7, rely = 0.5)
def set_down(self):
self.acl.bind('<Button-1>', self.accel_gn)
def set_up(self):
self.acl.bind('<ButtonRelease-1>',self.accel_fn)
def accel_fn(self,accel_fn): ##### ACCELERATION SLOWS DOWN
self.start = time()
print('up')
self.time_int = (self.start-self.end)
print(self.time_int)
def accel_gn(self,accel_gn): ##### ACCELERATION INCREASES
self.end = time()
a = speed()
print('down')
if 1 > self.time_int > 0:
print('current motor speed:', a.final_speed())
accel_gn(self,accel_gn)
中发生。为了明确起见,该按钮基本上检查了按下按钮的时间,并在另一个名为final_speed()的类中调用一个方法。
最佳答案
我认为您需要在self.time_int
中定义accel_gn
关于python - Python不断显示 'object has no such attribute',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56606081/
如果这不是一个错误,那就是另一个错误。如果不是那样的话,那就是别的东西了。我觉得我的项目已经改变了很多,现在只是试图解决代码签名问题,结果一切都搞砸了。我严格按照说明进行操作,但出现错误,例如当前的“
我不确定是否有一些我不知道的内置变量或规则,或者 make 是否有问题,或者我只是疯了。 对于我的一个项目,我有一个如下的 makefile: CC=g++ CFLAGS=-O3 `libpng-co
我有大约 10 个 div,它们必须不断翻转,每个 div 延迟 3 秒 这个 codrops 链接的最后一个效果是我正在寻找的,但无需单击 div http://tympanus.net/Devel
我如何使用 jQuery 持续运行 PHP 脚本并每秒获取响应,以及将鼠标上的少量数据发送到同一脚本? 我真的必须添加一些随机扩展才能让这么简单的计时器工作吗? 最佳答案 To iterate is
JBoss 4.x EJB 3.0 我见过如下代码(大大简化): @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPO
使用 PHPStorm,我试图忽略每次尝试进行 git 提交时 pop 的 workspace.xml。 我的 .gitignore 看起来像: /.idea/ .idea/workspace.xml
我是一名优秀的程序员,十分优秀!