Spaces:
Build error
Build error
| import kivy | |
| from kivy.app import App | |
| from kivy.uix.boxlayout import BoxLayout | |
| from kivy.uix.label import Label | |
| from kivy.uix.button import Button | |
| from kivy.uix.screenmanager import ScreenManager, Screen | |
| kivy.require('2.1.0') # Replace with the version of Kivy you have | |
| class HomeScreen(Screen): | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| layout = BoxLayout(orientation='vertical') | |
| layout.add_widget(Label(text='Welcome to Queen\'s Jewels', font_size=24)) | |
| btn_products = Button(text='View Products', size_hint=(1, 0.2)) | |
| btn_products.bind(on_press=self.go_to_products) | |
| layout.add_widget(btn_products) | |
| self.add_widget(layout) | |
| def go_to_products(self, instance): | |
| self.manager.current = 'products' | |
| class ProductScreen(Screen): | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| layout = BoxLayout(orientation='vertical') | |
| layout.add_widget(Label(text='Product List', font_size=24)) | |
| # Add more widgets for products here | |
| btn_back = Button(text='Back to Home', size_hint=(1, 0.2)) | |
| btn_back.bind(on_press=self.go_to_home) | |
| layout.add_widget(btn_back) | |
| self.add_widget(layout) | |
| def go_to_home(self, instance): | |
| self.manager.current = 'home' | |
| class QueenJewelsApp(App): | |
| def build(self): | |
| sm = ScreenManager() | |
| sm.add_widget(HomeScreen(name='home')) | |
| sm.add_widget(ProductScreen(name='products')) | |
| return sm | |
| if __name__ == '__main__': | |
| QueenJewelsApp().run() | |