0
간단한 Kivy 앱용 버튼 코드 두 개를 만들었지 만 버튼을 클릭하면 메소드를 실행할 수 없습니다. '버튼'개체가 어떤 속성 '로그인'다음Kivy 앱에서 버튼이 실행되고 있지 않습니다.
내 코드는이 없습니다 :
내가 클릭
버튼 '체크인', 그것은 AttributeError 말한다. 버튼을 클릭하면 메시지를 출력하고 싶습니다.from kivy.app import App
from kivy.lang import Builder
button1 = '''
BoxLayout:
Button:
text: 'Check In'
height: "40dp"
on_press: login()
size_hint: None, None
pos_hint: {'center_x': .1, 'center_y': .1}
canvas.before:
PushMatrix
Rotate:
angle: 0
origin: self.center
canvas.after:
PopMatrix
Button:
text: 'SOS'
size_hint: None, None
pos_hint: {'center_x': .1, 'center_y': .1}
canvas.before:
PushMatrix
Rotate:
angle: 0
origin: self.center
canvas.after:
PopMatrix
'''
class RotationApp(App):
def build(self):
return Builder.load_string(button1)
def login(self):
print("Click the goddamn button")
RotationApp().run()
우수. Kivy를 아는 사람은 stackoverflow에서 유일하게 보이는 것 같습니다. :)이 메시지는 내 메시지를 출력하지만 팝업으로 표시되지 않고 콘솔에 인쇄됩니다. 팝업으로 메시지를 표시하려면 어떻게해야합니까? – user2922822
'Popup(). open()'. 문서의 제목을 설정하거나 위젯을 추가하는 방법을 보려면 설명서를 참조하십시오. – inclement
다시 한번 감사드립니다. 같은 폴더에있는 다른 파일 (.py)에서 함수를 호출 할 수 있습니까? – user2922822