PyQt Multiple Windows - 如何在模块Qt Designer之间传递函数(PyQt Multiple Windows - how to pass functions between modules Qt Designer)
我将从问题开始,然后尝试解释:导入模块是否有办法在导入模块的模块中调用函数?
我只是学习使用Qt,并开始使用Qt Designer来获得一些基础知识。
我已经想出如何创建多个“.ui”文件以获取多个窗口的代码,并设法通过导入两个窗口的代码来解决如何从主应用程序调用多个窗口。
例如,从win1.ui和win2.ui开始我创建win1.py和win2.py - 从我的主应用程序我导入win1和win2 ...
注意 - 我通过以下简单教程得到了这一点: http : //www.youtube.com/watch?v = bHsC6WJsK-U& list = PLF4575388795F2531& index = 10& feature = plpp_video
好的 - 现在问题。 如果我在win2中有一个按钮,我知道如何将该按钮链接到win2.py代码中的函数。 我不知道怎么做是将win2中的按钮链接到我的主应用程序中的一个函数。
我唯一的想法是添加一个函数作为设置第二个窗口的类的参数,但如果我这样做,那么对win2.ui的任何更改都将破坏我已更改的代码。
因此,导入模块是否有办法在导入模块的模块中调用函数?
我希望这很清楚,不添加一堆不相关的代码......
I'll start with the question and then try to explain: Is there a way for an imported module to call a function in the module that imports it?
I am just learning to use Qt and am starting with Qt Designer to get some fundamentals worked out.
I have figured out how to create more than one ".ui" file in order to get the code for multiple windows and have managed to work out how to call the multiple windows from a main application by importing the code for the two windows.
For example, starting with win1.ui and win2.ui I create win1.py and win2.py - from my main application I import win1 and win2...
Note - I got this far by following this simple tutorial : http://www.youtube.com/watch?v=bHsC6WJsK-U&list=PLF4575388795F2531&index=10&feature=plpp_video
OK - now the question. If I have a button in win2, I know how to link that button to a function in the win2.py code. What I don't know how to do is link the button in win2 to a function in my main application.
My only thought would be to add a function as an argument to the class that sets up the second window but if I do that then any changes to win2.ui will wreck the code that I have changed.
Thus, Is there a way for an imported module to call a function in the module that imports it?
I hope this is clear without adding a bunch of code that isn't really relevant...
原文:https://stackoverflow.com/questions/12061251
最满意答案
使用
org.apache.isis.applib.value.Markup
使用属性解决了我的问题My problems solve by using property using
org.apache.isis.applib.value.Markup
相关问答
更多-
使用org.apache.isis.applib.value.Markup使用属性解决了我的问题 My problems solve by using property using org.apache.isis.applib.value.Markup
-
用例:请参阅我的评论Apache Isis:Java类型映射失败 根本原因:请参阅我的评论Apache Isis:Java类型映射失败 解决方案:没有官方解决方案。 我已经和大数据中心的Andy Jefferson谈过了。 但没有有用的答案。 最后,我已经自己修好了图书馆,并等待适当的修复 use case: see my comment Apache Isis: Java Type mapping failed root cause: see my comment Apache Isis: Java Ty ...
-
Apache ISIS外部链接(Apache ISIS external link)[2022-08-20]
有一个第三方扩展: https : //github.com/kev-m/isis-wicket-url/这是由我们的提交者之一Kevin Meyer完成的。 我已经提出了https://issues.apache.org/jira/browse/ISIS-1616 ,将其纳入框架“正确”。 同时,您可以添加一个动作来轻松打开链接 @Action(semantics=SemanticsOf.SAFE) @MemberOrder(named="link", sequence="1") public java. ... -
最简单的方法是将您想要运行的逻辑放在AbstractIsisSessionTemplate的子类中,然后从您的quartz作业中实例化并执行它。 Incode Platform的石英作业使用此技术来运行后台命令,请参见此处 ; 石英模块从石英角度展示了这一点(我认为你已经想到了)。 HTH Dan The easiest approach is to put the logic you want to run in a subclass of AbstractIsisSessionTemplate, and ...
-
根据我们的文档,注释该字段 Annotate the field instead ... as per our docs
-
你当然可以做后者; 子类RestfulObjectsApplication并使用addClass注册您的其他资源,然后在web.xml中指定您的新子类 担 You can certainly do the latter; subclass RestfulObjectsApplication and use addClass to register your additional resources, then specify your new subclass in web.xml Dan
-
可以使用ComponentType.HEADER更改完整标头。 设置自己的ComponentFactory,其优先级高于默认值。 It is possible to change the complete header by using ComponentType.HEADER. Setup your own ComponentFactory that will have higher priority than the default one.
-
请关注https://issues.apache.org/jira/browse/ISIS-1265 。 我们很快就会实施! Please follow https://issues.apache.org/jira/browse/ISIS-1265. We will implement it soon!
-
Apache ISIS isis-module-security默认用户/密码(Apache ISIS isis-module-security default user/password)[2024-04-23]
该模块定义了SeedSecurityModuleService ,它运行SeedUsersAndRolesFixtureScript ,后者又设置了帐户isis-module-security-admin帐户。 目前这是不可配置的,但您可以针对SeedSecurityModuleService引发PR,其中IsisModuleSecurityAdminUser fixture脚本可以使用@Inject ConfigurationService来读取要在配置属性中使用的名称的值,例如“isisaddons.m ... -
我不确定其含义是什么,但我能够通过在“Isis Core Runtime模块”中修改org.apache.isis.objectstore.jdo.datanucleus.DataNucleusApplicationComponents#createSchema来检查neo4j数据存储区并使用Apache Isis进行检查如果datanucleus StoreManager在转换之前支持SchemaAwareStoreManager接口。 它成功地保留了数据。 似乎太容易成为一个合法的增强,但我会由贡献者运 ...