在 Kivy 中部署多窗口应用程序
问题描述
这个线程显示了一种在 Kivy 应用程序中打开多个窗口的方法.需要创建多个应用程序,然后在需要时调用打开新窗口的应用程序.我从未部署过 Kivy 应用程序.所以我的问题是,如果部署用于分发,那会起作用吗?可以捆绑多个应用程序并放入一个可执行文件中吗?
This thread shows a way to open multiple windows in a Kivy app. It's necessary to create more than one app and then call the app that opens a new window when needed. I've never deployed a Kivy app. So my question is will that work if deploying for distribution? Can multiple apps be bundled up and put in an executable?
有问题的应用会弹出一个全屏窗口以显示第二个显示器.
The app in question pops out a full screen window to a second display.
Kivy 的多窗口情况是我正在处理的问题.幸运的是,上面的工作可以解决,但如果它不能很好地/根本无法部署,我不想继续沿着这条路走下去.
The multiple window situation with Kivy is an issue with what I'm working on. Fortunately the work around above will do but I don't want to continue going down that path if it won't deploy well/at all.
解决方案
第一件事:窗口!= 表格.问题(和答案)仅展示了如何在多个 apps(多个独立事物)之间进行通信以及如何从同一个解释器运行多个 apps 的方式.它可能看起来像一个工作形式,但它不是......而且很可能它甚至不会以这种方式表现,例如如果您不为此编写侦听器(没有简单的 other_form.my_widget.color
),那么以其他形式更改颜色对您不起作用.看看这个.
First thing: Window != Form. The question (and answer) only show a way how to communicate between multiple apps(multiple standalone things) and how to run multiple apps from the same interpreter. It may look like a working forms, but it's not... and most probably it won't even behave in this way e.g. changing color in other form won't work for you this way if you won't write a listener for that (no simple other_form.my_widget.color
). Look at this.
如果它在解释器中工作,如果你正确打包它,它会在部署后工作,因为打包基本上是把整个编译的平台解释器和你的 .py
文件放在某个地方.
If it works in the interpreter, it will work after deploying if you package it correctly, because packaging is basically putting whole compiled-for-desired-platform interpreter with your .py
file somewhere.
无论如何,你为什么要拥有多个窗口?您只能在 Kivy 中使用 Drag Behavior 进行同样的操作和 ModalView 让您的整个应用程序保持简单、干净和易于调试.
Anyway, why do you want to have multiple windows? The same thing you can make within Kivy only with Drag Behavior and ModalView keeping your whole app simple, clean and easier to debug.
(意思是如果客户破坏了某些东西而您没有合适的记录器,那么调试这些多窗口会很有趣)
相关文章