2017-03-01 48 views
1

私は問題の解決策を2〜3時間から見つけようとしていますが、探しているときでさえも間違っているSOまたはKivyのドキュメントの他のユーザーの問題をここで確認してください。Kivyボタンウィジェット:属性エラー、属性 'fbind'がありません

私は現在、オンラインでいくつかのチュートリアルを、以下の午前、と私のコードは正確に彼と一致していませんが、テストとして、このチュートリアルの正確なコードを複製しながらも、私が手this simple one

と周りのおもちゃになりましたKivyのButtonウィジェットに関する正確な同じエラー:

AttributeError: 'Button' object has no attribute 'fbind' 

これは何らかのインストール問題に関連する可能性がありますか?誰も私がこれを解決するのを手助けできますかここで

[INFO    ] Kivy v1.8.0 
[INFO    ] [Logger  ] Record log in C:\Users\NoirFluo\.kivy\logs\kivy_17-03-01_64.txt 
[INFO    ] [Factory  ] 157 symbols loaded 
[DEBUG    ] [Cache  ] register <kv.lang> with limit=None, timeout=Nones 
[DEBUG    ] [Cache  ] register <kv.image> with limit=None, timeout=60s 
[DEBUG    ] [Cache  ] register <kv.atlas> with limit=None, timeout=Nones 
[INFO    ] [Image  ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif 
[DEBUG    ] [Cache  ] register <kv.texture> with limit=1000, timeout=60s 
[DEBUG    ] [Cache  ] register <kv.shader> with limit=1000, timeout=3600s 
[DEBUG    ] [App   ] Loading kv <C:/Users/NoirFluo/Desktop/Python/Kivy/TestProblemButton\screens.kv> 
[DEBUG    ] [Window  ] Ignored <egl_rpi> (import error) 
[INFO    ] [Window  ] Provider: pygame(['window_egl_rpi'] ignored) 
[DEBUG    ] [Window  ] Display driver windib 
[DEBUG    ] [Window  ] Actual window size: 800x600 
[DEBUG    ] [Window  ] Actual color bits r8 g8 b8 a8 
[DEBUG    ] [Window  ] Actual depth bits: 24 
[DEBUG    ] [Window  ] Actual stencil bits: 8 
[DEBUG    ] [Window  ] Actual multisampling samples: 2 
[INFO    ] [GL   ] OpenGL version <4.5.13464 Compatibility Profile Context 21.19.407.0> 
[INFO    ] [GL   ] OpenGL vendor <ATI Technologies Inc.> 
[INFO    ] [GL   ] OpenGL renderer <AMD Radeon HD 7800 Series> 
[INFO    ] [GL   ] OpenGL parsed version: 4, 5 
[INFO    ] [GL   ] Shading version <4.50> 
[INFO    ] [GL   ] Texture max size <16384> 
[INFO    ] [GL   ] Texture max units <32> 
[DEBUG    ] [Shader  ] Fragment compiled successfully 
[DEBUG    ] [Shader  ] Vertex compiled successfully 
[DEBUG    ] [ImagePygame ] Load <C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\data\glsl\default.png> 
[INFO    ] [Window  ] virtual keyboard not allowed, single mode, not docked 
[INFO    ] [Text  ] Provider: pygame 
GLEW initialization succeeded 

Traceback (most recent call last): 

    File "<ipython-input-1-414e3aba4aa1>", line 1, in <module> 
    runfile('C:/Users/NoirFluo/Desktop/Python/Kivy/TestProblemButton/main.py', wdir='C:/Users/NoirFluo/Desktop/Python/Kivy/TestProblemButton') 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile 
    execfile(filename, namespace) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile 
    exec(compile(scripttext, filename, 'exec'), glob, loc) 

    File "C:/Users/NoirFluo/Desktop/Python/Kivy/TestProblemButton/main.py", line 26, in <module> 
    ScreensApp().run() 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\app.py", line 766, in run 
    root = self.build() 

    File "C:/Users/NoirFluo/Desktop/Python/Kivy/TestProblemButton/main.py", line 23, in build 
    return Manager() 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\uix\screenmanager.py", line 791, in __init__ 
    super(ScreenManager, self).__init__(**kwargs) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\uix\floatlayout.py", line 66, in __init__ 
    super(FloatLayout, self).__init__(**kwargs) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\uix\layout.py", line 63, in __init__ 
    super(Layout, self).__init__(**kwargs) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\uix\widget.py", line 173, in __init__ 
    Builder.apply(self) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\lang.py", line 1566, in apply 
    self._apply_rule(widget, rule, rule) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\lang.py", line 1672, in _apply_rule 
    self.apply(child) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\lang.py", line 1566, in apply 
    self._apply_rule(widget, rule, rule) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\lang.py", line 1670, in _apply_rule 
    child = cls(__no_builder=True) 

    File "C:\Users\NoirFluo\Anaconda2\lib\site-packages\kivy\uix\behaviors\button.py", line 83, in __init__ 
    self.fbind('state', self.cancel_event) 

AttributeError: 'Button' object has no attribute 'fbind'` 

screens.kvファイルからのコードは次のとおりです。ここで

#:kivy 1.8.0 

<ScreenOne>: 
    Button: 
     text: "On SCREEN 1 >> Go to Screen 2" 
     on_press: root.manager.current = "screen2" 

<ScreenTwo>: 
    Button: 
     text: "On SCREEN 2 >> Go to Screen 3" 
     on_press: root.manager.current = "screen3" 

<ScreenThree>: 
    Button: 
     text: "On SCREEN 3 >> Go to Screen 1" 
     on_press: root.manager.current = "screen1" 


<Manager>: 
    id: screen_manager 

    screen_one: screen_one 
    screen_two: screen_two 
    screen_three: screen_three 

    ScreenOne: 
     id: screen_one 
     name: "screen1" 
     manager: screen_manager 

    ScreenTwo: 
     id: screen_two 
     name: "screen2" 
     manager: screen_manager 

    ScreenThree: 
     id: screen_three 
     name: "screen3" 
     manager: screen_manager 

はmain.pyのコードです:

# -*- coding: utf-8 -*- 
from kivy.app import App 
from kivy.uix.screenmanager import ScreenManager, Screen 
from kivy.properties import ObjectProperty 

class ScreenThree(Screen): 
    pass 

class ScreenTwo(Screen): 
    pass 

class ScreenOne(Screen): 
    pass 

class Manager(ScreenManager): 
    screen_one = ObjectProperty(None) 
    screen_two = ObjectProperty(None) 
    screen_three = ObjectProperty(None) 

class ScreensApp(App): 

    def build(self): 
     return Manager() 

if __name__ == "__main__": 
    ScreensApp().run() 

編集:MHH、編集者が私を食べています"こんにちは、皆さん!"、私はいくつかの理由で私の投稿を編集して戻すことができないので、私はここに入れます:こんにちは、みんな! ^^ '

+2

トピックのうち、なぜkivy 1.8.0を使用しますか? – Juggernaut

答えて

0

Kivy 1.8.0は恐竜ですが、すぐに現在の旧式の安定版(1.9.1)より新しいバージョンが登場します。

私はあなたのコードを試してみたところ、うまくいきました。問題なく1.8.0でもうまくいきました。

今、あなたはこれらのいずれかのアクション実行できます。完全にあなたが使用したいタグからあなたKivyのインストールを再インストール

  • を(それは1.8.0だ場合、うまくそれのために行く)

  • インストール安定版

  • インストール最新Kivyバージョン

instructionsの方法を確認してください。十分でないか固すぎる場合は、this installerを使用してください。ちょうどメモ、これはではありません!kivy.batと同じことをしています(1.8.0パッケージにこのようなファイルがありましたが、これ以上はありません)、古いものの代わりとしては機能しません。

関連する問題