【发布时间】:2014-12-27 17:24:12
【问题描述】:
使用此代码,我想要做的是分组并显示几个按钮,并在按下每个按钮时打开一个应用程序。
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)
每次我运行程序时,它都会显示弹出窗口未定义或应用程序运行并立即关闭,谁能告诉我我做错了什么。我是编程新手。
【问题讨论】:
-
你有什么问题?
-
我做了这个问题。