Creating a Custom Interface

Use the Python library Tkinter to create custom GUIs for GisLink addins

TIP: To access SIS API commands, we recommend extending the ‘tkinter.Tk’ class, passing a SIS GisLink object to its __init__ method.

Ensure your extended tkinter.Tk class has its ‘mainloop’ method called by a GisLink event handler; this should be passed as the GisLink event object.

import  tkinter

      # Define GUI launch button (in GisLink class __init__)
        self.btn2 = gislink.RibbonButton(text="GUI Launcher",description="Description",help="Help")


      def on_click_launch_gui(self, event):
        # Launch GUI (class code below)
        gui = MyGisLinkGUI(event.map_modeller)

# Custom GUI class, extends tkinter.Tk
class MyGisLinkGUI(tkinter.Tk):
    def __init__(self, sis):
        self.sis = sis

        # Force our GUI to top window
        self.wm_attributes("-topmost", 1)

        # Grab some data from the SIS API
        label_text = "SIS Build Number: " + str(self.sis.GetProperty(2,0,"_BuildNumber&"))

     # GUI component definition
        self.label = tkinter.Label(self, text=label_text)