我如何在Kivy中拥有多个窗口? [英] How do I have multiple windows in Kivy?

查看:211
本文介绍了我如何在Kivy中拥有多个窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从完全不同的GUI打开一个GUI.我在台式机上进行开发,并且窗口的大小彼此不同.我看着屏幕管理器,但感觉好像有一种更简单的方法.

I am trying to open one GUI from a completely different GUI. I am developing on a desktop and the windows have different sizes from each other. I looked at screen manager but I feel as if there is an easier way to do this.

提前谢谢!

推荐答案

可能,但是有点不方便.问题是kivy每个应用程序仅支持一个窗口,因此您需要以某种方式解决它.我个人只是在一个窗口中使用多个* Layouts(它们是具有不同功能的不同GUI),并根据需要显示和隐藏它们.显然,这种方法有其局限性,例如, eg 不支持多个监视器,但是它变得非常简单.

It's possible, but kinda inconvenient. The issue is that kivy supports only one window per app, so you need to work around it somehow. I personally just use multiple *Layouts (which are different GUIs with different functions) in a single window, showing and hiding them as necessary. Obviously this approach has its restrictions, eg it doesn't support multiple monitors, but it's as simple as it gets.

然后有一个问题在SO上的此处,人们可以为每个窗口生成单独的kivy应用程序,从而获得可以相对拖动和调整大小的窗口.它需要摆弄子流程并在应用之间进行通信,但是这种方法功能更强大.

Then there is a question here on SO where people spawn separate kivy apps for every window, thus getting windows that can be dragged and resized relatively. It requires some fiddling with subprocesses and communicating between apps, but this method is more powerful.

ScreenManager对您没有帮助:它仅允许为同一窗口定义多个窗口小部件树,并在它们之间即时切换.这是触摸屏上的正常用例,但在台式机上几乎没有意义.坦白说,对于许多猕猴桃来说,这是正确的.如果您不打算以后再使用手机,那么Tkinter或PyQT可能比kivy更好.

ScreenManager, as I understand, doesn't help you: it allows just to define multiple widget trees for the same window and switch between them on the fly. It's a normal use case on touchscreens, but makes pretty little sense on desktop. Which is true for quite a few things in kivy, to be honest. If you don't plan to move to mobiles later, Tkinter or PyQT may be a better choice than kivy.

这篇关于我如何在Kivy中拥有多个窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆