私は、複数の画面kivyアプリケーションをPythonでビルドしようとしています。コンパイル時にエラーはありません。アプリケーションは正常にコンパイルされます。私は複数の画面を実現するためにkivyのScreen Managerを使用しています。ボタンをクリックすると、トランジションは起こりません。トランジションを手伝ってください。ここに私のコードの実際のスニペットがあります。Kivy複数の画面遷移が起こらない
main.pyファイル
import kivy
from kivy.app import App
from kivy.app import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmamager import ScreenManager, Screen
class LoginScreen(Screen):
pass
class SignUpScreen(Screen):
pass
class MainScreen(BoxLayout):
pass
class MyScreenManager(ScreenManager):
pass
class AuthenticationApp(App):
def build(self):
return MyScreenManager()
if __name__ == '__main__':
AuthenticationApp().run()
Authentication.kvファイル
<MyScreenManager>
MainScreen:
SecondScreen:
<SecondScreen>:
name: 'Second'
BoxLayout:
orientation: 'vertical'
canvas:
Rectangle:
source: 'images/blue.png'
pos: self.pos
size: self.size
BoxLayout:
orientation: 'vertical'
size_hint: 1,0.25
Label:
text: 'Vigilantdsjkadhakjshdakjsd Dollop'
font_size: '15sp'
size_hint: 1, 0.20
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.1
Button:
id: login_button
text: 'Login'
font_size: '15sp'
on_release: app.root.current = 'Main'
Button:
id: login_button
text: 'Sign Up'
font_size: '15sp'
Button:
id: login_button
text: 'Recover'
font_size: '15sp'
Button:
id: login_button
text: 'Reset'
font_size: '15sp'
BoxLayout:
orientation: 'vertical'
size_hint: 1,0.75
Button:
text: 'Page'
<MainScreen>:
name: 'Main'
BoxLayout:
orientation: 'vertical'
canvas:
Rectangle:
source: 'images/blue.png'
pos: self.pos
size: self.size
BoxLayout:
orientation: 'vertical'
size_hint: 1,0.25
Label:
text: 'Vigilant Dollop'
font_size: '15sp'
size_hint: 1, 0.20
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.1
Button:
id: login_button
text: 'Login'
font_size: '15sp'
Button:
id: login_button
text: 'Sign Up'
font_size: '15sp'
on_press: root.current = 'Second'
Button:
id: login_button
text: 'Recover'
font_size: '15sp'
Button:
id: login_button
text: 'Reset'
font_size: '15sp'
BoxLayout:
orientation: 'vertical'
size_hint: 1,0.75
Button:
text: 'Page'
回答を受け入れるといいですね。 – Juggernaut