Kivy/Python exception: cannot open dropdown list on a hidden widget -


i'm building ui touchscreen many different screens. 1 screen needs have dropdown list select language. i've tried many ways of creating dropdown no success. recently, i've gotten error:

traceback (most recent call last): file "/users/revascharf/documents/college work/senior year/screenstest/screen.py", line 91, in <module> presentation = builder.load_file("screen.kv") file "/applications/kivy.app/contents/resources/kivy/kivy/lang.py", line 1842, in load_file  return self.load_string(data, **kwargs) file "/applications/kivy.app/contents/resources/kivy/kivy/lang.py", line 1921, in load_string  self._apply_rule(widget, parser.root, parser.root) file "/applications/kivy.app/contents/resources/kivy/kivy/lang.py", line 2082, in _apply_rule  child = cls(__no_builder=true) file "/users/revascharf/documents/college work/senior year/screenstest/screen.py", line 85, in __init__  ddbutt.bind(on_release=dropdown.open(self)) file "/applications/kivy.app/contents/resources/kivy/kivy/uix/dropdown.py", line 220, in open  'cannot open dropdown list on hidden widget') kivy.uix.dropdown.dropdownexception: cannot open dropdown list on hidden widget 

from i've been able read online, seems might issue screen manager , drop down being incompatible. can point me i'm going wrong? issue surrounding createprofilescreen.

screen.py:

from kivy.app import app kivy.lang import builder kivy.uix.textinput import textinput kivy.uix.screenmanager import screenmanager, screen kivy.properties import stringproperty, listproperty, objectproperty kivy.uix.dropdown import dropdown kivy.uix.button import button   class homescreen(screen):     pass  class settingsscreen(screen):     pass  class startuserrunscreen(screen):     pass  class manageuserprofilesscreen(screen):     pass  class initialpanelconfigscreen(screen):     panel_connect = stringproperty()     panelno = 0      def __init__(self, **kwargs):         super(initialpanelconfigscreen, self).__init__(**kwargs)         self.panel_connect = 'connect panel: ' + str(self.panelno)      def panelconnected(self):         #python i2c code goes here send actual address         if self.panelno < 20:             self.panelno += 1             self.panel_connect = 'connect panel: ' + str(self.panelno)      def cancelbutton(self):         #app.root.current = 'settings'         self.panelno = 0         self.panel_connect = 'connect panel: ' + str(self.panelno)  class adjustvolumescreen(screen):     pass  class createprofilescreen(screen):     def __init__(self, *args, **kwargs):         super(createprofilescreen, self).__init__(*args, **kwargs)         dropdown = dropdown()         languages = ['english', 'spanish', 'french', 'cantonese']          lang in languages:             btn = button(text='%r' % lang, size_hint_y=.26, size_hint_x=.085)             btn.bind(on_release=lambda btn: dropdown.select(btn.text))             dropdown.add_widget(btn)         ddbutt = objectproperty(none)         ddbutt.bind(on_release=dropdown.open(self))         dropdown.bind(on_select=lambda instance, x: setattr(ddbutt, 'text', x))  class screenmanagement(screenmanager):     pass  presentation = builder.load_file("screen.kv")  class mainapp(app):     def build(self):         return presentation  if __name__ == '__main__':     mainapp().run() 

screen.kv:

#: import sm kivy.uix.screenmanager screenmanagement:     transition: sm.notransition()     homescreen:     settingsscreen:     startuserrunscreen:     manageuserprofilesscreen:     initialpanelconfigscreen:     adjustvolumescreen:     createprofilescreen:  <homescreen>:     name: 'home'     floatlayout:         label:             text: 'carter school sensory walk'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          image:             source: 'sensorywalklogo.png'             size_hint: .68, .68             pos_hint: {'x': -.045, 'y': .09}          button:             on_press: app.root.current = 'settings'             text: 'settings'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .33}          button:             on_press: app.root.current = 'startrun'             text: 'start user run'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .63}          button:             on_press: app.root.current = 'manageprofiles'             text: 'manage user profiles'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .48}          button:             text: 'exit'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .18}             on_press: exit()    <settingsscreen>:     name: 'settings'      floatlayout:         label:             text: 'settings'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             on_press: app.root.current = 'home'             text: 'return home'             font_size: 17             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}          button:             text: 'adjust brightness'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .1, 'y': .63}          button:             text: 'adjust volume'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .1, 'y': .48}             on_press: app.root.current = 'volume'          button:             text: 'panel replacement'             font_size: 20             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .63}          button:             text: 'initial panel configuration'             font_size: 17.5             size_hint: .27, .12             pos_hint: {'x': .63, 'y': .48}             on_press: app.root.current = 'initpanelconfig'  <startuserrunscreen>:     name: 'startrun'      floatlayout:         label:             text: 'select user'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             on_press: app.root.current = 'home'             text: 'return home'             font_size: 17             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}   <manageuserprofilesscreen>:     name: 'manageprofiles'      floatlayout:         label:             text: 'manage user profiles'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             on_press: app.root.current = 'home'             text: 'return home'             font_size: 17             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}          button:             text: 'create new user profile'             font_size: 30             size_hint: .5, .15             pos_hint: {'x': .25, 'y': .6}             on_press: app.root.current = 'createprofile'          button:             text: 'edit existing user profile'             font_size: 30             size_hint: .5, .15             pos_hint: {'x': .25, 'y': .4}          button:             text: 'delete user profile'             font_size: 30             size_hint: .5, .15             pos_hint: {'x': .25, 'y': .2}  <initialpanelconfigscreen>:     name: 'initpanelconfig'      floatlayout:         label:             text: 'initial panel configuration'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             text: 'cancel'             font_size: 20             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}             on_press:                 app.root.current = 'settings'                 root.cancelbutton()          button:             text: 'panel connected'             font_size: 28             size_hint: .3, .12             pos_hint: {'x': .35, 'y': .1}             on_press: root.panelconnected()          label:             text: root.panel_connect             font_size: 32             pos_hint: {'x': 0, 'y': .04}  <adjustvolumescreen>:     name: 'volume'      floatlayout:         label:             text: 'settings: volume'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             text: 'return settings'             font_size: 17             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}             on_press: app.root.current = 'settings'  <createprofilescreen>:     name: 'createprofile'     ddbutt: langbutt      floatlayout:         label:             text: 'new profile'             font_size: 40             pos_hint: {'x': 0, 'y': .4}          button:             text: 'create profile'             font_size: 30             size_hint: .26, .12             pos_hint: {'x': .37, 'y': .03}          button:             text: 'cancel'             font_size: 20             size_hint: .189, .09             pos_hint: {'x': .811, 'y': 0}             on_press: app.root.current = 'manageprofiles'          textinput:             size_hint: .26, .075             pos_hint: {'x': .23, 'y': .71}             multiline: false          label:             text: 'user name:'             font_size: 25             pos_hint: {'x': -.38, 'y': .25}          label:             text: ' language \npreference:'             font_size: 23             pos_hint: {'x': -.38, 'y': 0}          button:             id: langbutt             size_hint: .26, .085             pos_hint: {'x': .23, 'y': .46}             font_size: 20             text: 'choose language' 

did not figure out how work around dropdown issue, found needed, spinner work well. able implement spinner in place of dropdown.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -