So modern HMI/Scada use web-based front-end to visual components or widgets for a user to interact with.
The great thing is we could do exactly the same thing with other UI Layout software + Render. In this case we will use Kivy.
If you are python programmer you are lucky because we could use front-end and back-end by using Python.
And use UI Layout script language to define the UI layout in markup type language.
Lets pretend we like to make UI Layout with 3 buttons to change the screen (same thing we do with tab for browser).
we will call this UI Layout markup language in Kivy drawer_nav.kv
When you understand how Kivy is working it could become very powerful for prototype touch-screen by visual interaction but also user inputs.
The idea is kind of simple using Raspberry Pi with a touch screen to communicate with other device. The great thing is Kivy
is made for touch inputs and use OpenGL ES in other words GPU acceleration.
In my journey to understand UI Layout and different use of markup language I discover how powerful Kivy is.
Enjoy, maybe it could become a start for something special
Here is the screenshot of the UI Layout
![[203128%2F9378026%2Fmceclip0]](https://d28lcup14p4e72.cloudfront.net/203128%2F9378026%2Fmceclip0.png)
BoxLayout:
orientation: 'horizontal'
id: main_layout
AnchorLayout:
anchor_x: 'left'
anchor_y: 'top'
size_hint_x: 0.25
canvas.before:
Color:
rgba: 0.1, 0.15, 0.2, 1
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
orientation: 'vertical'
size_hint: None, None
size: 100, 360
padding: [15, 25, 15, 15] # x, y, width, height
spacing: 15
MDBoxLayout:
orientation: 'horizontal'
size_hint: None, None
size: 250, 100
md_bg_color: 0.2, 0.3, 0.4, 1
radius: [24]
padding: [20, 0]
spacing: 15
on_touch_up:
if self.collide_point(*args[1].pos): main_layout.ids.screen_manager.current = 'home'
MDIcon:
icon: "view-dashboard"
size_hint: None, None
size: 36, 36
padding_y: 24
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
MDLabel:
text: "Home"
valign: "middle"
halign: "left"
text_size: self.size
padding_y: 10
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
font_style: "Subtitle1"
MDBoxLayout:
orientation: 'horizontal'
size_hint: None, None
size: 250, 100
md_bg_color: 0.2, 0.3, 0.4, 1
radius: [24]
padding: [20, 0]
spacing: 15
on_touch_up:
if self.collide_point(*args[1].pos): main_layout.ids.screen_manager.current = 'info'
MDIcon:
icon: "information"
size_hint: None, None
size: 36, 36
padding_y: 24
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
MDLabel:
text: "Info"
valign: "middle"
halign: "left"
text_size: self.size
padding_y: 10
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
font_style: "Subtitle1"
MDBoxLayout:
orientation: 'horizontal'
size_hint: None, None
size: 250, 100
md_bg_color: 0.2, 0.3, 0.4, 1
radius: [24]
padding: [20, 0]
spacing: 15
on_touch_up:
if self.collide_point(*args[1].pos): main_layout.ids.screen_manager.current = 'conf'
MDIcon:
icon: "cog"
size_hint: None, None
size: 36, 36
padding_y: 24
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
MDLabel:
text: "Conf"
valign: "middle"
halign: "left"
text_size: self.size
padding_y: 10
theme_text_color: "Custom"
text_color: 1, 1, 1, 1
font_style: "Subtitle1"
ScreenManager:
id: screen_manager
Home:
Info:
Conf:
<Home>:
name: 'home'
MDLabel:
text: "Dashboard Home View"
halign: "center"
valign: "center"
<Info>:
name: 'info'
MDLabel:
text: "Information Panel"
halign: "center"
valign: "center"
<Conf>:
name: 'conf'
MDLabel:
text: "Your Configuration Settings"
halign: "center"
valign: "center"
This is the main code in Python
from kivymd.app import MDApp
from kivy.lang import Builder
from kivymd.uix.screen import MDScreen
class Home(MDScreen): pass
class Info(MDScreen): pass
class Conf(MDScreen): pass
class MyApp(MDApp):
def build(self):
return Builder.load_file("drawer_nav.kv")
if __name__ == "__main__":
MyApp().run()