headersのbottonをおしたらback_botton_moにかかれた名前の画面が移動する という感じにしたいのですが うまくいきません
試したこと 思いついたこと
mainScreenからはroot.manager.currentでふつうにいけます
headersはmainScreen以外でもしようすうるのでmainScreen.manager.currentとするわけにもいきません
rootが親クラスmainScreenになると勘違いしていたので
root.headers.manager.currentで試したのですが そもそもroot=headersなので失敗
<headers> Button: id: addbotton text: root.add_botton_str size_hint:(None,None) size: 60,30 hint_text: 'Input Text' on_press: print("back") if not root.back_botton_str==None:root.manager.transition.direction = 'left';root.manager.current = root.back_botton_mo
class headers(BoxLayout): back_botton_str=StringProperty('') add_botton_str=StringProperty('') def __init__(self,back_botton_mo="main",add_botton_mo="add", **kwargs): super(headers, self).__init__(**kwargs) #pos: 50,root.height-46 self.back_botton_mo=back_botton_mo self.add_botton_mo=add_botton_mo self.back_botton_str='<-back' self.add_botton_str='add' if self.back_botton_str==None: self.back_botton_str="esc" if self.add_botton_str==None: self.add_botton_str="xxxx" class mainScreen(Screen): def __init__(self, **kwargs): super(mainScreen, self).__init__(**kwargs) self.viewlen=0 self.subscreen() self.headers=headers(back_botton_mo="main",add_botton_mo="add",pos=(50,600))
あなたの回答
tips
プレビュー