From ccfbaf0f8d7f65d8cb3494091bdac9097260e5d0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 6 Sep 2023 11:25:01 -0400 Subject: [PATCH] interface-design --- list.kv | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 31 ++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 list.kv create mode 100644 main.py diff --git a/list.kv b/list.kv new file mode 100644 index 0000000..4fdf067 --- /dev/null +++ b/list.kv @@ -0,0 +1,153 @@ +WindowManager: + ListScreen: + ItemScreen: + +: + name: 'List' + canvas.before: + Color: + rgba: 1, 1, 1, 1 # Set the color to red (RGBA format) + Rectangle: + pos: self.pos + size: self.size + + BorderImage: + size: self.size + pos: self.pos + source: '' + border: 10, 10, 10, 10 + Color: + rgba: 1, 0, 0, 1 # Set the color to red (RGBA format) + + GridLayout: + rows: 3 + BoxLayout: + padding: 10, 10, 10, 10 + size_hint: (1, 0.3) + Image: + source: './img/top.png' + size: self.texture_size + + GridLayout: + cols: 2 + rows: 2 + spacing: 30 + padding: 10 + Image: + source: './img/1-1.png' + size: self.texture_size + on_touch_down: root.select_item() + Image: + source: './img/1-2.png' + size: self.texture_size + Image: + source: './img/2-1.png' + size: self.texture_size + Image: + source: './img/2-2.png' + size: self.texture_size + + BoxLayout: + padding: 10, 10, 10, 10 + size_hint: (1, 0.3) + RelativeLayout: + Image: + source: './img/bottom.png' + size: self.texture_size + +: + name: 'Item' + + canvas.before: + Color: + rgba: 1, 1, 1, 1 # Set the color to red (RGBA format) + Rectangle: + pos: self.pos + size: self.size + + GridLayout: + rows: 3 + GridLayout: + cols: 2 + spacing: 10 + BoxLayout: + padding: 10 + RelativeLayout: + Image: + source: './img/1-1.png' + size: self.texture_size + GridLayout: + rows: 2 + GridLayout: + padding: 10, 50, 10, 10 + cols: 2 + spacing: 5 + GridLayout: + rows: 5 + spacing: 5 + Label: + text: 'Art.Nr:' + color: (0,0,0,1) + Label: + text: 'Züge:' + color: (0,0,0,1) + Label: + text: 'Nikotin:' + color: (0,0,0,1) + Label: + text: 'Akku:' + color: (0,0,0,1) + Label: + text: 'Tankvol.:' + color: (0,0,0,1) + GridLayout: + rows: 5 + spacing: 5 + Label: + text: 'ABC1234' + color: (0,0,0,1) + Label: + text: '600' + color: (0,0,0,1) + Label: + text: '20mg' + color: (0,0,0,1) + Label: + text: '400mAh' + color: (0,0,0,1) + Label: + text: '2ml' + color: (0,0,0,1) + GridLayout: + cols: 3 + spacing: 5 + Image: + source: './img/left.png' + size: self.texture_size + Label: + text: '10.00 EUR' + color: (0,0,0,1) + Image: + source: './img/right.png' + size: self.texture_size + + GridLayout: + cols: 2 + spacing: 20 + padding: 10, 20, 10, 20 + size_hint: (1, 0.3) + Button: + text: '20.00 Eur' + color: (0,0,0,1) + background_normal: './img/bg-btn-1.png' + background_color: (1,1,1,0.5) + Button: + text: 'Buy' + background_color: (0,0,1,1) + border_radius: [20] + + BoxLayout: + size_hint:(1, 1) + RelativeLayout: + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..c906e97 --- /dev/null +++ b/main.py @@ -0,0 +1,31 @@ +from kivy.app import App +from kivy.core.window import Window +from kivy.lang import Builder +from kivy.uix.button import ButtonBehavior +from kivy.uix.screenmanager import ScreenManager, Screen +from kivy.properties import StringProperty + +class ListScreen(Screen): + def select_item(self): + app = App.get_running_app() + app.root.current = 'Item' + +class ItemScreen(Screen): + pass + +class WindowManager(ScreenManager): + pass + +kv = Builder.load_file('list.kv') + +class MainApp(App): + # Main Application + def build(self): + Window.size = (600, 850) + sm = ScreenManager() + sm.add_widget(ListScreen(name='List')) + sm.add_widget(ItemScreen(name='Item')) + return sm + +if __name__ == '__main__': + MainApp().run() \ No newline at end of file