使用Python在ControlDesk上进行多重布局[已解决] [英] Multi layout on ControlDesk using Python [solved]
本文介绍了使用Python在ControlDesk上进行多重布局[已解决]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows2000 Pack4下使用controDesk Developer V2.7 Unicode。我使用微型自动装置使用Simulink V6.3文件进行汽车测量。它工作正常。我希望第二个布局与我可以激活的主要布局一起工作,并通过一个简单的开关(在主要布局上)在线停用。是否有可能,如果是,如何做到这一点?
Thnaks。
Hi,
I m using controDesk Developer V2.7 Unicode under Windows2000 Pack4. I do automotive mesurments with Simulink V6.3 files using a micro-autobox. it works correctly. I want to have a second layout working with the principal one that I can activate and desactivate online with a simple switch (on the principal layout). Is it possible and if yes how this can be done?
Thnaks.
推荐答案
这是Python的代码位于主要布局的按钮:
# - * - 编码:cp1252 - * -
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData() :
"""
语法:On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
目的:WriteData事件处理程序。
参数:无
"""
print" On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData called"
这是我要激活的布局的名称:
layout_2.py
它们位于同一目录中
欢迎任何问题
谢谢
This is the Python code of the button located in the principal layout:
# -*- coding: cp1252 -*-
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData():
"""
Syntax : On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
Purpose : WriteData event handler.
Parameters : None
"""
print "On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData called"
and this is the name of the layout I want to activate :
layout_2.py
they are located in the same directory
any questions are welcome
Thanks
这是位于主要布局中的按钮的Python代码:
# - * - 编码:cp1252 - * -
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData():
"""
语法:On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
目的: WriteData事件处理程序。
参数:无
"""
print" On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData叫做
,这是我要激活的布局名称:
layout_2.py
它们位于同一目录中
欢迎任何问题
谢谢
This is the Python code of the button located in the principal layout:
# -*- coding: cp1252 -*-
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData():
"""
Syntax : On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
Purpose : WriteData event handler.
Parameters : None
"""
print "On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData called"
and this is the name of the layout I want to activate :
layout_2.py
they are located in the same directory
any questions are welcome
Thanks
我喜欢导入代码顶部以显示依赖关系:
I like to import at the top of the code to show dependencies:
展开 | 选择 | Wrap | 行号
您好,感谢您的帮助,但不幸的是我没有成功它。举一个简单的例子,我有2个布局,layout_1和layout_2。第一个是OnOffButton。在第二个,我有一个显示面板。这是我在_layout_1.py文件中写的:
# - * - 编码:cp1252 - * -
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData( ):
"""
语法:On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
目的:WriteData事件处理程序。 />
参数:无
"""
import layout_2
打印" On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData called"
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_Click():
"""
语法:On_Instrumentation_layout_1_dSPACEPushButtonContro l_Click ()
目的:点击事件处理程序。
参数:无
"" ;"
print" On_Instrumentation_layout_1_dS PACEPushButtonContr ol_Click调用
def SomeFunction():
#缩进脚本的所有代码
if __name__ == " __ main __":
SomeFuntion()#仍将以脚本形式运行
"""""""""" ;""""""""""""""""""""""""" ;
这是在_layout_2.py文件中写的:
def On_Instrumentation_layout_2_dSPACEDisplayControl_C lick():
"""
语法:On_Instrumentation_layout_2_dSPACEDisplayControl_C lick()
目的:点击事件处理程序。
参数:无
""
print" On_Instrumentation_layout_2_dSPACEDisplayControl_点击调用
def layout_2 .SomeFunction():
#在这里缩进脚本的所有代码
if __name__ ==" __ main __":
SomeFuntion()#仍将以脚本形式运行
''"""""""""""""" ;""""""""""""""
您注意到我添加了您在第一封邮件中发布的内容。
在动画模式下单击按钮时没有任何反应。我通过编辑WriteData通过事件窗口访问Python代码。我想要做的是通过动画模式点击OnOffButton来激活和取消激活layout2窗口。
这是我的界面图片:http://mederreg.lotfi .free.fr / python / event_python.JPG
谢谢
Hi, thanks for the help but unfortunately I didn''t succeed to do it. Taking a simple example, I have 2 layouts, layout_1 and layout_2. On the first there is an OnOffButton. In the second one, I ve got a display panel. This is what I wrote in the file _layout_1.py:
# -*- coding: cp1252 -*-
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData():
"""
Syntax : On_Instrumentation_layout_1_dSPACEPushButtonContro l_WriteData()
Purpose : WriteData event handler.
Parameters : None
"""
import layout_2
print "On_Instrumentation_layout_1_dSPACEPushButtonContr ol_WriteData called"
def On_Instrumentation_layout_1_dSPACEPushButtonContro l_Click():
"""
Syntax : On_Instrumentation_layout_1_dSPACEPushButtonContro l_Click()
Purpose : Click event handler.
Parameters : None
"""
print "On_Instrumentation_layout_1_dSPACEPushButtonContr ol_Click called"
def SomeFunction():
# Indent all the code of the script here
if __name__ == "__main__":
SomeFuntion() # Will still run as a script
"""""""""""""""""""""""""""""""""""
This is what it is written in the _layout_2.py file:
def On_Instrumentation_layout_2_dSPACEDisplayControl_C lick():
"""
Syntax : On_Instrumentation_layout_2_dSPACEDisplayControl_C lick()
Purpose : Click event handler.
Parameters : None
"""
print "On_Instrumentation_layout_2_dSPACEDisplayControl_ Click called"
def layout_2.SomeFunction():
# Indent all the code of the script here
if __name__ == "__main__":
SomeFuntion() # Will still run as a script
''"""""""""""""""""""""""""""
You notice that I added what you have posted in your first message.
Nothing happens when I click on the button at the animation mode. I access to the Python code through the events window by editing WriteData. What I want to do is to activate and disactivate the layout2 window by clicking on the OnOffButton through the animation mode.
this is a picture of my interface: http://mederreg.lotfi.free.fr/python/event_python.JPG
Thanks
这篇关于使用Python在ControlDesk上进行多重布局[已解决]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文