久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

    1. <tfoot id='eBN8L'></tfoot>

          <bdo id='eBN8L'></bdo><ul id='eBN8L'></ul>

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

      1. 如何使用 Kivy 的 FileChooser 選擇多個文件?

        How to select multiple files with FileChooser with Kivy?(如何使用 Kivy 的 FileChooser 選擇多個文件?)

          • <bdo id='Wx4UA'></bdo><ul id='Wx4UA'></ul>

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

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

                    <tbody id='Wx4UA'></tbody>

                  本文介紹了如何使用 Kivy 的 FileChooser 選擇多個文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在使用 kivy 和 python 來構(gòu)建應(yīng)用程序.

                  I am using kivy and python to build an application.

                  我正在嘗試構(gòu)建一個應(yīng)用程序,我可以在其中選擇多個圖像,將它們添加到一個數(shù)組中,然后通過另一個拼接圖像的方法(使用stitcher 類)傳遞這個圖像數(shù)組.輸出圖像將顯示在三個屏幕之一(我也想移除中間屏幕).

                  I am trying to build an application in which I can select several images, add them to an array, and then pass this array of images through another method which stitches the images (using the stitcher class). The output image will display on one of the three screens (also I want to remove the middle screen).

                  所以本質(zhì)上我想要幫助的是如何能夠在 kivy 中使用 filechooser 選擇多個文件,然后將這些文件添加到我以后可以通過不同方法傳遞的數(shù)組中.

                  So essentially what I would like help with is how to be able to select multiple files with filechooser in kivy and then add these files to array that I can later pass through a different method.

                  在 這篇文章,我已經(jīng)可以創(chuàng)建應(yīng)用了.

                  With the help of @ikolim in this post, I have been able to create the application.

                  ma??in.py

                  from kivy.app import App
                  from kivy.uix.tabbedpanel import TabbedPanel
                  from kivy.properties import ObjectProperty
                  from PIL import Image
                  
                  
                  class RootWidget(TabbedPanel):
                      manager = ObjectProperty(None)
                      img = ObjectProperty(None)
                      img3 = ObjectProperty(None)
                      img4 = ObjectProperty(None)
                      lab = ObjectProperty(None)
                  
                      def on_touch_up(self, touch):
                          if not self.img3.collide_point(*touch.pos):
                              return True
                          else:
                              self.lab.text = 'Pos: (%d,%d)' % (touch.x, touch.y)
                              return True
                  
                      def switch_to(self, header):
                          # set the Screen manager to load  the appropriate screen
                          # linked to the tab head instead of loading content
                          self.manager.current = header.screen
                  
                          # we have to replace the functionality of the original switch_to
                          self.current_tab.state = "normal"
                          header.state = 'down'
                          self._current_tab = header
                  
                      def select_to(self, *args):
                          try:
                              print(args[1][0])
                              iw = Image.open(args[1][0])
                              iw.save('./phase.jpg')
                              gray = iw.convert('1')
                              gray.save('./gray_im.jpg')
                              self.img3.source = './gray_im.jpg'
                              self.img4.source = './gray_im.jpg'
                              self.img.source = './phase.jpg'
                              self.img.reload()
                              self.img3.reload()
                              self.img4.reload()
                          except:
                              pass
                  
                      def update_touch_label(self, label, touch):
                          label.text = 'Pos:(%d, %d)' % (touch.x, touch.y)
                          label.texture_update()
                          label.pos = touch.pos
                          label.size = label.texture_size[0] + 20, label.texture_size[1] + 20
                  
                  
                  class TestApp(App):
                      title = 'Screen Widget'
                  
                      def build(self):
                          return RootWidget()
                  
                      def on_pause(self):
                          return True
                  
                  
                  if __name__ == '__main__':
                      TestApp().run()
                  

                  Test.kv

                  #:kivy 1.10.1
                  
                  <RootWidget>:
                      manager: manager
                      img: img
                      img3: img3
                      img4: img4
                      lab: lab
                      do_default_tab: False
                  
                      ScreenManager:
                          id: manager
                  
                          Screen:
                              id: sc1
                              name:'Load img'
                  
                              FileChooserIconView:
                                  canvas.before:
                                      Color:
                                          rgb: 0.5, 0.4, 0.5
                                      Rectangle:
                                          pos: self.pos
                                          size: self.size
                                  on_selection:
                                      root.select_to(*args)
                  
                          Screen:
                              id: sc2
                              name: 'Image'
                  
                              FloatLayout:
                                  Button:
                                      id: lab
                                      pos_hint: {"right": 0.55, 'top': 1}
                                      size_hint: .15,0.1
                  
                              RelativeLayout:
                                  Image:
                                      id: img
                                      on_touch_down:
                                          str('Relative:{}'.format(args[1].pos))
                                      pos_hint: {"left": 1, 'bottom': 1}
                                      size_hint: 0.5, 1
                                      allow_stretch: True
                  
                              RelativeLayout:
                                  Image:
                                      id: img3
                                      pos_hint: {"right": 1, 'bottom': 1}
                                      size_hint: 0.5, 1
                                      allow_stretch: True
                  
                          Screen:
                              id: sc3
                              name: 'Image_'
                  
                              FloatLayout:
                                  Image:
                                      id: img4
                                      keep_data: True
                                      post: self.pos
                                      size: self.size
                  
                      TabbedPanelHeader:
                          text: sc1.name
                          background_color: 1, 0, 0, 1
                          screen: sc1.name
                  
                      TabbedPanelHeader:
                          text: sc2.name
                          background_color: 1, 1, 0, 1
                          screen: sc2.name
                  
                      TabbedPanelHeader:
                          text: sc3.name
                          background_color: 1, 0, 1, 1
                          screen: sc3.name
                  

                  推薦答案

                  這是一個我認為你想要的例子:

                  Here is an example that does what I think you want:

                  import os
                  
                  import kivy
                  from kivy import platform
                  from kivy.app import App
                  from kivy.uix.button import Button
                  from kivy.uix.floatlayout import FloatLayout
                  import kivy.garden.filebrowser
                  
                  
                  class FileBrowserApp(App):
                  
                      def build(self):
                          self.root = FloatLayout()
                          button = Button(text='Select Files', pos_hint={'x':0, 'y': 0}, size_hint=(0.2, 0.1))
                          button.bind(on_press=self.do_select)
                          self.root.add_widget(button)
                          return self.root
                  
                      def do_select(self, *args):
                          homeDir = None
                          if platform == 'win':
                              homeDir = os.environ["HOMEPATH"]
                          elif platform == 'android':
                              homeDir = os.path.dirname(os.path.abspath(__file__))
                          elif platform == 'linux':
                              homeDir = os.environ["HOME"]
                          self.fbrowser = kivy.garden.filebrowser.FileBrowser(select_string='Select',
                              multiselect=True, filters=['*.png'], path=homeDir)
                          self.root.add_widget(self.fbrowser)
                          self.fbrowser.bind(
                              on_success=self._fbrowser_success,
                              on_canceled=self._fbrowser_canceled,
                              on_submit=self._fbrowser_success)
                  
                      def _fbrowser_success(self, fbInstance):
                          if len(fbInstance.selection) == 0:
                              return
                          selected = []
                          for file in fbInstance.selection:
                              selected.append(os.path.join(fbInstance.path, file))
                          print('selected: ' + str(selected))
                          self.root.remove_widget(self.fbrowser)
                          self.fbrowser = None
                  
                      def _fbrowser_canceled(self, instance):
                          self.root.remove_widget(self.fbrowser)
                          self.fbrowser = None
                  
                  if __name__=="__main__":
                      app = FileBrowserApp()
                      app.run()
                  

                  這篇關(guān)于如何使用 Kivy 的 FileChooser 選擇多個文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應(yīng)命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                • <tfoot id='PUU6Y'></tfoot>

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

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

                          <tbody id='PUU6Y'></tbody>

                        <i id='PUU6Y'><tr id='PUU6Y'><dt id='PUU6Y'><q id='PUU6Y'><span id='PUU6Y'><b id='PUU6Y'><form id='PUU6Y'><ins id='PUU6Y'></ins><ul id='PUU6Y'></ul><sub id='PUU6Y'></sub></form><legend id='PUU6Y'></legend><bdo id='PUU6Y'><pre id='PUU6Y'><center id='PUU6Y'></center></pre></bdo></b><th id='PUU6Y'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PUU6Y'><tfoot id='PUU6Y'></tfoot><dl id='PUU6Y'><fieldset id='PUU6Y'></fieldset></dl></div>
                          • <bdo id='PUU6Y'></bdo><ul id='PUU6Y'></ul>
                          • 主站蜘蛛池模板: 天天操狠狠操 | 久久久无码精品亚洲日韩按摩 | 免费久久精品视频 | 婷婷久久网| 岛国毛片在线观看 | 91精品国产一区二区三区 | 久草视频网站 | 国产免费一区二区 | 亚洲欧美在线观看视频 | 成人自拍视频 | 日韩国产精品一区二区三区 | 99精品免费视频 | 久久久日韩精品一区二区三区 | 欧美 日韩 国产 成人 在线 | 欧美精品一区在线发布 | 中文字幕国产精品 | 久久久久国产精品一区二区 | 日韩男人天堂 | 青青草一区二区 | 亚洲国产视频一区二区 | 国产精品污www在线观看 | 中文字幕精品一区久久久久 | 欧美精品二区 | 久久久黄色 | 午夜精品久久久久久久久久久久久 | 国产精品久久久亚洲 | av先锋资源 | 韩国久久精品 | 狠狠操狠狠干 | 亚洲精品一区二区三区四区高清 | 懂色一区二区三区免费观看 | 搞av.com | 国产91网址 | 国产成人一区二区三区久久久 | 久久久久网站 | 欧美黄在线观看 | 美女久久久久 | 日本午夜一区二区三区 | 久久人| 中文字幕日韩欧美 | 精品欧美一区二区三区久久久 |