Programming Graphical User Interfaces (GUI)

Since ANDi allows the usage of .Net classes, it is possible to use them to create GUIs.

The class library of .Net can be found in the official place.


Be aware to add the corresponding imports. The syntax must be also according to .Net

Buttons menu example

# --- Imports

from globals import *


from System.Windows.Forms import Application, Form, TableLayoutPanel, Button, DockStyle, MessageBox
from System.Drawing import Color

# --- Functions

class GUI_Dialog(Form):

        def __init__(self, width, height):

                self.Text = "GUI MENU"
                self.Width = width
                self.Height = height

                l_tbl_content_panel = TableLayoutPanel()
                l_tbl_content_panel.AutoSize = True
                l_tbl_content_panel.Dock = DockStyle.Fill
                l_tbl_content_panel.AutoScroll = True

                self.panel_right = TableLayoutPanel()
                self.panel_right.Dock = DockStyle.Fill
                self.panel_right.BackColor = Color.LightGray

                self.btn_iCAM = self.create_button("Start Test", self.on_click_btn_start)
                self.btn_satCam = self.create_button("Show Message", self.on_click_btn_show_message)
                self.btn_satCam = self.create_button("Stop Test", self.on_click_btn_stop)

                l_tbl_content_panel.Controls.Add(self.panel_right, 0,0)


        def create_button(self, name, listener):
                btn = Button()
                btn.Click += listener
                btn.Text = name
                btn.Parent = self.panel_right
                btn.Width = 160
                btn.Height = 35
                return btn

        def on_click_btn_start(self, sender, args):
                # actions

        def on_click_btn_show_message(self, sender, args):
                MessageBox.Show("My message here")

        def on_click_btn_stop(self, sender, args):
                # actions

#----  MAIN  ----#

Application.Run(GUI_Dialog(250, 250))