python - Kivy ButtonBehavior is not defined error -
i running ubuntu 14.1 kivy 1.9.0 python 2.7
i attempting write small program utilizes buttonbehavior keeps saying name not defined during application startup. have program uses buttonbehavior , boots fine. copied import directly file works , still keep getting same error. tried uninstalling kivy , re-installing has not worked. spellings , reason not load app.
here traceback:
[info ] [kivy ] v1.9.0 [info ] [python ] v2.7.6 (default, jun 22 2015, 17:58:13) [gcc 4.8.2] [info ] [image ] providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored) [info ] [factory ] 173 symbols loaded [info ] [text ] provider: sdl2 [info ] [osc ] using <multiprocessing> socket [info ] [window ] provider: sdl2(['window_egl_rpi'] ignored) [info ] [gl ] opengl version <3.0 mesa 10.1.3> [info ] [gl ] opengl vendor <intel open source technology center> [info ] [gl ] opengl renderer <mesa dri intel(r) broadwell > [info ] [gl ] opengl parsed version: 3, 0 [info ] [gl ] shading version <1.30> [info ] [gl ] texture max size <8192> [info ] [gl ] texture max units <32> [info ] [window ] auto add sdl2 input provider [info ] [window ] virtual keyboard not allowed, single mode, not docked traceback (most recent call last): file "uf.py", line 27, in <module> class testicon(buttonbehavior, image): nameerror: name 'buttonbehavior' not defined
import kivy import subprocess kivy.uix.behaviors import buttonbehavior kivy.uix.gridlayout import gridlayout kivy.uix.boxlayout import boxlayout kivy.uix.floatlayout import floatlayout kivy.uix.button import button kivy.uix.label import label kivy.uix.scrollview import scrollview kivy.clock import clock import ufhubtest uf import time port_num = 3 power_off_secs = 3 power_on__secs = 3 class listviewlabel(label): pass class passfail(label): pass class testicon(buttonbehavior, image): pass class mainlayout(boxlayout): self.pf = objectproperty() self.ti = objectproperty() self.passcount = 0 self.failcount = 0 self.hubdev = none def find_hub(self): self.hubdev = usb.core.find(idvendor=0x0424, idproduct=0x2640) if self.hubdev none: self.pf.text= "no hub found port power control" time.sleep = 2 sys.exit(1) else: clock.schedule_once(self.run_test) def run_test(self): #clock.unschedule(self.run_test) while true: try: uf.port_power1(hubdev, port_num, false) time.sleep(power_off_secs) uf.port_power1(hubdev, port_num, true) time.sleep(power_on__secs) dhub = usb.core.find(idvendor=dut_vid, idproduct=dut_pid) if dhub not none: passcount = passcount + 1 print "%s: pass:%d fail:%d" % (datetime.now().strftime('%y-%m-%d %h:%m:%s'), passcount, failcount) else: failcount = failcount + 1 print "%s: pass:%d fail:%d -- hub not found" % (datetime.now().strftime('%y-%m-%d %h:%m:%s'), passcount, failcount) except (keyboardinterrupt, systemexit): print "interrupted" break class ufapp(app): pass if __name__=="__main__": ufapp().run()
in class mainlayout
, use self.
outside of function. read errors more carefully.
Comments
Post a Comment