简体   繁体   English

appJar 中是否有更快的 setLabel 方法

[英]Is there a faster setLabel method in appJar

I'm making an app to view CAN data from a car using appJar.我正在制作一个应用程序来使用 appJar 从汽车中查看 CAN 数据。 I have a thread getting the CAN buffer then sending it to the main loop using queueFucntion.我有一个线程获取 CAN 缓冲区,然后使用 queueFucntion 将其发送到主循环。 the function queued to the main loop iterates threw the buffer and sends the data to the Label with the same address as the data.排队到主循环的 function 迭代抛出缓冲区并将数据发送到与数据具有相同地址的 Label。

I found that CAN overloads the main loop queue ( raise Full ).我发现 CAN 使主循环队列超载( raise Full )。 when I time the function sent to the main queue it has a run time of about ~4ms but when I add a label that matches a message it shoots up to ~100ms.当我将 function 计时发送到主队列时,它的运行时间约为 4 毫秒,但是当我添加与消息匹配的 label 时,它会发射高达 100 毫秒的消息。

I think this means the setLabel method takes to long.我认为这意味着 setLabel 方法需要很长时间。 and I want to know if there is a faster way.我想知道是否有更快的方法。 Ultimately a faster setLabel won't actually solve my problem but it will help最终,更快的 setLabel 并不能真正解决我的问题,但它会有所帮助

update更新

I use wing personal 7 as an IDE for python and when I ran my program from outside of wing my code ran a lot faster and didn't overflow but my question still stands.我将机翼个人 7 用作 python 的 IDE,当我从机翼外部运行程序时,我的代码运行得更快并且没有溢出,但我的问题仍然存在。

update x2更新 x2

I implemented message filtering at the module level by hijacking the module as a parent.我通过劫持模块作为父模块在模块级别实现消息过滤。 this helped a crap tonne but as my app runs it starts developing a delay between the car and the output and I think that means the buffer is filling up.这帮助了很多废话,但是当我的应用程序运行时,它开始在汽车和 output 之间产生延迟,我认为这意味着缓冲区正在填满。

I found that gui.addLabel() returns the actual label object.我发现gui.addLabel()返回实际的 label object。

When you use gui.setLable(title, text) appJar uses a widget manager class to Search a dictionary of created Label objects with a key matching the title setLabel the sets that dict value using .config(text=text)当您使用gui.setLable(title, text) appJar 使用小部件管理器 class 搜索创建的 Label 对象的字典,其键与标题匹配 setLabel 使用.config(text=text)的集合

So basically you can bypass the searching by keeping track of the label yourself and using所以基本上你可以通过自己跟踪 label 并使用来绕过搜索

yourLabelHere.config(text='Your string here')

In theory, this is faster but int practice I don't really know从理论上讲,这更快,但我真的不知道在实践中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM