sam
sam

Reputation: 19164

filebrowser error in windows for kivy

I have installed dev version 1.8 for kivy. Now I am installing the kivy-designer in windows. I have done with installing filebrowser in tools.

python ../garden.py install filebrowser
[INFO              ] Kivy v1.8.0-dev

still, when I am trying to run main.py of kivy designer in windows, it gives me error :

  Traceback (most recent call last):
     File "main.py", line 2, in <module>
     from designer.app import DesignerApp
     File "D:\Kivy-1.6.0-w32\kivy\kivy\tools\kivy-designer\designer\app.py", line 17, in <module>
     from kivy.garden.filebrowser import FileBrowser
     ImportError: No module named filebrowser

how i will solve this error?

Upvotes: 3

Views: 4462

Answers (5)

Allamaris
Allamaris

Reputation: 21

pip install kivy_garden.filebrowser

then

from kivy_garden.filebrowser import FileBrowser

@SherylHohman

Thx for your comment. I wouldn't add my answer if it didn't work. I know this topic is old, but I encountered the similar problem. This fragment doesn't work anymore. from kivy.garden.filebrowser import FileBrowser

It seems that kivy-garden changed format.

Here is sample code for a filebrowser:

from kivy.app import App
from os.path import sep, expanduser, isdir, dirname
from kivy_garden.filebrowser import FileBrowser
import sys


class TestApp(App):

    def build(self):
        if sys.platform == 'win':
            user_path = dirname(expanduser('~')) + sep + 'Documents'
        else:
            user_path = expanduser('~') + sep + 'Documents'
        browser = FileBrowser(select_string='Select',
                              favorites=[(user_path, 'Documents')])
        browser.bind(
                    on_success=self._fbrowser_success,
                    on_canceled=self._fbrowser_canceled)
        return browser

    def _fbrowser_canceled(self, instance):
        print('cancelled, Close self.')

    def _fbrowser_success(self, instance):
        print(instance.selection)

TestApp().run()

Look at this image

However I prefer to use filedialog(from tkinter) with Kivy :)

Upvotes: 1

ceremcem
ceremcem

Reputation: 4350

They say "...we provide a tool in kivy/tools/garden..." but there is no such tool. So I got a workaround by installing required package manually by following http://kivy-garden.github.io/:

  1. Create "garden"s root directory:

    mkdir ~/.kivy/garden
    
  2. Download garden.filebrowser from https://github.com/kivy-garden/garden.filebrowser into this folder:

    cd ~/.kivy/garden
    git clone https://github.com/kivy-garden/garden.filebrowser
    
  3. Optionally, you may check your installation. In Python terminal, type:

    import kivy.garden.filebrowser
    

Upvotes: 4

bersby
bersby

Reputation: 1

Download kivy garden from https://pypi.python.org/packages/a9/af/362e0fe6943c6b7ec2630b49d1886649a4708ab748ce378acf74e4104c8b/kivy-garden-0.1.1.tar.gz

create a root directory for kivy garden like this

mkdir kivy/garden

Then use robocopy to copy the downloaded kivy garden into your root directory like this

robocopy C:\downloads\garden-0.1.1 C:\kivy\garden /e

When the files have been moved successfully, restart your command. Then install FileBrowser with this command

garden install FileBrowser

That worked for me like a charm!!

Upvotes: 0

BarthesSimpson
BarthesSimpson

Reputation: 969

Late to the party, but I just downloaded garden from pypi here and then ran python setup.py install from within the directory.

Upvotes: 0

timberlinemusic
timberlinemusic

Reputation: 1

After a "garden install filebrowser" on OSX mavericks - I had to copy the garden directory from ~/.kivy/garden to /Library/Python/2.7/site-packages/kivy which worked, could probably be done with a symlink.

Upvotes: 0

Related Questions