2014-12-26 3 views
0

이 코드로, 내가하려는 것은 그룹화하고 서로 옆에 몇 개의 버튼을 표시하고 각 버튼을 누르면 애플리케이션이 열립니다.새 위젯을 열고 버튼을 정렬하십시오. 파이썬, KIVY

PY 파일

class CustomPopup(popup): 
    pass 


class TestApp(App): 

    def build(self): 
    help_me_button = Button(text='HELP ME') 
    help_me_button.bind(on_press=self.open_helpme) 
    games_button = Button(text='GAMES') 
    games_button.bind(on_press=self.open_games) 

    buttons = BoxLayout(orientation='horizontal') 
    buttons.add_widget(help_me_button) 
    buttons.add_widget(game_button) 


    return layout 

def open_help_me(self, help_me): 
    p = self.popup 

    p = Popup(content=help_me, 
       title='Help Me', 
       size_hint=(0.8, 0.8)) 

     if p.content is not help_me: 
      p.content = help_me 
     p.open() 
    else: 
     super(HelpMeApp, self).display_helpme(HelpMe) 

나는 그것이 팝업 또는 응용 프로그램이 실행을 정의하지 말한다 즉시 종료 프로그램을 실행할 때마다, 누군가가 말해 줄 수 내가 잘못 뭘하는지. 프로그래밍에 익숙하지 않습니다.

+0

What is your question ? – kartikg3

+0

나는 그 질문을했다. –

답변

1

p = self.popup이 없어야합니다. 당신은 정의되지 않은 "self.popup"에 접근하려고 시도한다. 다음 라인은 당신이 옳은 일을하고 있고, 새로운 팝업을 만들고있다. (p = Popup (...)을 쓰면된다.)

관련 문제