无法关闭Kivy应用或避免全屏显示 [英] Can't close Kivy app or avoid fullscreen

查看:172
本文介绍了无法关闭Kivy应用或避免全屏显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Kivy的新手,正在尝试寻找解决方法.每当我创建并运行一个应用程序时,它就会以全屏显示,如果不断开电源就无法关闭(我知道这并不理想,但这正是我迫切需要修复它的原因!).

I am new to Kivy and trying to find my way around. Whenever I create and run an app, it displays as a full-screen that I am unable to close without disconnecting the power (which I know is not ideal, but that's exactly why I am desperate to fix it!).

建议使用的快捷键(Esc,Ctrl + C,Ctrl + Alt + break)不起作用.我尝试如下更改脚本开头的配置设置:

Shortcuts that are suggested to work (Esc, Ctrl+C, Ctrl+Alt+break) don't. I have attempted changing the config settings at the beginning of the script as follows:

from kivy.config import Config
Config.set('graphics', 'fullscreen', 0)
Config.write()

我还尝试过主题的变化-0作为字符串,1作为整数和字符串(并尝试为窗口提供宽度和高度),但是没有明显的变化.即使这样做确实可行,但鉴于我可能最终希望能够全屏运行,这也不是理想的解决方法!

I've also tried variations on the theme - 0 as a string, 1 as both an integer and string (and trying to provide a width and height for the window) but with no perceivable change. Even if this did work, it would not be the ideal fix given that I would probably want to be able to run things full-screen in the end!

鉴于每次我尝试更改某些东西时都必须通过断开电源来重新启动pi,因此玩游戏非常耗时! 有人对我应该如何进行有任何建议吗?

Given that each time I've tried changing something I've had to restart the pi by disconnecting the power, playing around has been quite time-consuming! Does anybody have any suggestions about how I should proceed?

我当前正在使用:
将Raspberry Pi 2 Model B连接到普通电视(许多有问题的人一直在使用触摸屏,但这对我来说不是真的)
Raspbian Jessie,Linux 8
Python 2.7
恐怕我不知道如何检查有关我下载的Kivy模块的详细信息.

I'm currently using:
Raspberry Pi 2 Model B connected to normal TV (many people having problems have been using a touchscreen, but that is not true for me)
Raspbian Jessie, Linux 8
Python 2.7
I'm afraid I don't know how to check details about the Kivy module I have downloaded.

我对此很陌生,因此,如果我未能提供所有相关信息,我们深表歉意.

I'm very new to this, so apologies if I don't manage to provide all of the relevant information.

我要运行的完整代码(不包括上述配置更改):

Full code I am trying to run (excluding the above config changes):

import kivy  
kivy.require('1.9.2') #may be part of the problem - not 100% sure this is correct 

from kivy.app import App  
from kivy.uix.label import Label  


class MyApp(App):  

    def build(self):  
        return Label(text='Hello world')  


if __name__ == '__main__':  
    MyApp().run()

推荐答案

要变通解决此问题,您可以将全屏显示更改为假,这样奇异果可以在 Ctrl + C .

To work around this issue, you can change the full screen to fake so kivy can exit on Ctrl+C.

from kivy.config import Config
Config.set('graphics', 'fullscreen', 'fake')
Config.write()

此外,尝试在命令行提示符下运行代码.在运行kivy应用程序时,避免使用raspberry pi的桌面环境.这样可以释放pi的内存来运行kivy.

Also, try to run the code in command line prompt. Avoid raspberry pi's desktop environment while running kivy apps. This will free up pi's memory for running kivy.

这篇关于无法关闭Kivy应用或避免全屏显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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