python - Kivy Popup or Eventloop Interaction? -
the first screen of app has small menu (in gridlayout) of 3 buttons. 2 supposed open popups. 1 , 1 about. third 1 changes screen.
only 1 popup works. first 1 called (in kivy file) works, second doesn't open popup. if switch order in cdd.kv, other 1 works.
excerpt cdd.kv:
cddmainmenulayout: helpbutton: size_hint: .5,.5 metadatabutton: size_hint: .5,.5 on_release: app.root.current = 'metadata' aboutbutton: size_hint: .5,.5
excerpt main.py:
class cddmainmenulayout(gridlayout): """ provides layout 3 buttons on home screen. """ def __init__(self, *args, **kwargs): super(cddmainmenulayout, self).__init__(*args, **kwargs) self.rows = 1 self.cols = 3 self.size_hint = (.5,.5)
...
class cddbutton(button): def __init__(self, **kwargs): super(cddbutton, self).__init__(**kwargs) self.text = _('button') self.background_color = colors.grey2 class aboutbutton(cddbutton): def __init__(self, **kwargs): super(aboutbutton, self).__init__(**kwargs) self.text = _("about cdd") self.background_color = colors.red1 = popup() a.title = _("about constraint definition designer, version - " + __version__) a.content = rstdocument(source='about.rst') a.size_hint_x = .8 a.size_hint_y = .8 self.bind(on_release=a.open) class helpbutton(cddbutton): def __init__(self, **kwargs): super(helpbutton, self).__init__(**kwargs) self.text = _("help") self.background_color = colors.green1 h = popup() h.title = _("cdd help") h.content = rstdocument(source='help.rst') h.size_hint_x = .8 h.size_hint_y = .8 self.bind(on_release=h.open)
does change if add lines self.popup = h
, self.popup = a
? 1 possibility popups being garbage collected since don't store references them. i'm not sure if/how give particular behaviour, it's worth try.
Comments
Post a Comment