• <tfoot id='zpmYe'></tfoot>
  • <small id='zpmYe'></small><noframes id='zpmYe'>

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

        <legend id='zpmYe'><style id='zpmYe'><dir id='zpmYe'><q id='zpmYe'></q></dir></style></legend>
          <bdo id='zpmYe'></bdo><ul id='zpmYe'></ul>
      1. Kivy:拖放,获取文件路径

        时间:2023-10-10
          <tbody id='BrK6O'></tbody>

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

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

                  本文介绍了Kivy:拖放,获取文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 Kivy 中,我正在尝试构建一个界面,用户可以在其中将文件拖放到小部件(文本输入)中,然后我的代码将检索该文件的文件系统路径(/path/to/users.文件).这似乎比使用 FileChooser 小部件更简单,但我该怎么做呢?

                  In Kivy, I am trying to build an interface where the user can drag and drop a file into a widget (text input) and then my code would retrieve the file system path of that file (/path/to/users.file). That seems like a simpler approach than using the FileChooser widget, but how would I do it?

                  谢谢!

                  推荐答案

                  使用on_dropfile 事件处理程序.这是一个工作示例:

                  Use on_dropfile event handler. Here is an working example:

                  from kivy.app import App
                  from kivy.core.window import Window
                  
                  
                  class WindowFileDropExampleApp(App):
                      def build(self):
                          Window.bind(on_dropfile=self._on_file_drop)
                          return
                  
                      def _on_file_drop(self, window, file_path):
                          print(file_path)
                          return
                  
                  if __name__ == '__main__':
                      WindowFileDropExampleApp().run()
                  

                  这篇关于Kivy:拖放,获取文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:同时运行多个相互通信的 Kivy 应用程序 下一篇:kivy python通过按钮单击将参数传递给函数

                  相关文章

                  最新文章

                  <legend id='L2eap'><style id='L2eap'><dir id='L2eap'><q id='L2eap'></q></dir></style></legend>

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

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

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