• <small id='JJ0xM'></small><noframes id='JJ0xM'>

    <legend id='JJ0xM'><style id='JJ0xM'><dir id='JJ0xM'><q id='JJ0xM'></q></dir></style></legend>
  • <i id='JJ0xM'><tr id='JJ0xM'><dt id='JJ0xM'><q id='JJ0xM'><span id='JJ0xM'><b id='JJ0xM'><form id='JJ0xM'><ins id='JJ0xM'></ins><ul id='JJ0xM'></ul><sub id='JJ0xM'></sub></form><legend id='JJ0xM'></legend><bdo id='JJ0xM'><pre id='JJ0xM'><center id='JJ0xM'></center></pre></bdo></b><th id='JJ0xM'></th></span></q></dt></tr></i><div id='JJ0xM'><tfoot id='JJ0xM'></tfoot><dl id='JJ0xM'><fieldset id='JJ0xM'></fieldset></dl></div>

      • <bdo id='JJ0xM'></bdo><ul id='JJ0xM'></ul>
      <tfoot id='JJ0xM'></tfoot>

        kivy .kv 文件无法读取

        时间:2023-10-10

      1. <legend id='bpptM'><style id='bpptM'><dir id='bpptM'><q id='bpptM'></q></dir></style></legend>
        <i id='bpptM'><tr id='bpptM'><dt id='bpptM'><q id='bpptM'><span id='bpptM'><b id='bpptM'><form id='bpptM'><ins id='bpptM'></ins><ul id='bpptM'></ul><sub id='bpptM'></sub></form><legend id='bpptM'></legend><bdo id='bpptM'><pre id='bpptM'><center id='bpptM'></center></pre></bdo></b><th id='bpptM'></th></span></q></dt></tr></i><div id='bpptM'><tfoot id='bpptM'></tfoot><dl id='bpptM'><fieldset id='bpptM'></fieldset></dl></div>
        • <bdo id='bpptM'></bdo><ul id='bpptM'></ul>
          <tfoot id='bpptM'></tfoot>

              <tbody id='bpptM'></tbody>

                <small id='bpptM'></small><noframes id='bpptM'>

                1. 本文介绍了kivy .kv 文件无法读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我刚刚开始学习编程.我有一个基于 kivy.org 网站上的乒乓球游戏教程的非常基本的应用程序,但我必须有一个我看不到的基本缺陷,因为当我运行程序时,我得到的只是一个空白屏幕而不是预期的画布和标签.

                  I have just started learning to program. I have a really basic App based on a pong game tutorial on the kivy.org website, but I must have a basic flaw that I can't see, because when I run the program, all I am getting is a blank screen rather than the expected canvas and labels.

                  from kivy.app import App
                  from kivy.uix.button import Button
                  from kivy.uix.widget import Widget
                  
                  class Singularity(Widget):
                      pass
                  
                  class SingularityApp(App):
                      def build(self):
                          return Singularity()
                  
                  if __name__ in ('__main__', '__android__'):
                      SingularityApp().run()
                  

                  和singularity.kv:

                  and the singularity.kv:

                  #:kivy 1.9.0
                  
                  <Singularity>:    
                      canvas:
                          Rectangle:
                              pos: self.center_x - 5, 0
                              size: 10, self.height
                              
                      Label:
                          font_size: 70  
                          center_x: root.width / 4
                          top: root.top - 50
                          text: "0"
                          
                      Label:
                          font_size: 70  
                          center_x: root.width * 3 / 4
                          top: root.top - 50
                          text: "0"
                  

                  推荐答案

                  • 检查您的 MainApp(App) 类名是否与不带App"的 .kv 文件名相同(如果不是,请将它们设为相同).它不区分大小写.例如:MaNagerApp(App) 将加载 ma​​nager.kv.
                    • Check whether your MainApp(App) class name is same as your .kv file name without the 'App' (if not, make them the same). It's not case sensitive. For example: MaNagerApp(App) will load manager.kv.
                      • 如果您不想更改名称,则只需添加 self.load_kv(your_kv_file_name),如下所示:

                      def build(self):
                          self.load_kv('singularity.kv')
                          return Singularity()
                      

                      这篇关于kivy .kv 文件无法读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 kv 语言中动态制作很多按钮? 下一篇:将 kivy 小部件保存到文件

                  相关文章

                  最新文章

                  • <bdo id='FsZmZ'></bdo><ul id='FsZmZ'></ul>
                2. <legend id='FsZmZ'><style id='FsZmZ'><dir id='FsZmZ'><q id='FsZmZ'></q></dir></style></legend>
                3. <small id='FsZmZ'></small><noframes id='FsZmZ'>

                    <i id='FsZmZ'><tr id='FsZmZ'><dt id='FsZmZ'><q id='FsZmZ'><span id='FsZmZ'><b id='FsZmZ'><form id='FsZmZ'><ins id='FsZmZ'></ins><ul id='FsZmZ'></ul><sub id='FsZmZ'></sub></form><legend id='FsZmZ'></legend><bdo id='FsZmZ'><pre id='FsZmZ'><center id='FsZmZ'></center></pre></bdo></b><th id='FsZmZ'></th></span></q></dt></tr></i><div id='FsZmZ'><tfoot id='FsZmZ'></tfoot><dl id='FsZmZ'><fieldset id='FsZmZ'></fieldset></dl></div>

                      <tfoot id='FsZmZ'></tfoot>