Skip to content

getting started

DavideMasini edited this page Aug 15, 2021 · 2 revisions

In order to make a GUI with the toolkit you will need to follow the following steps to get started.

  1. Make sure that you have the appropriate files in your project folder

  2. Import App and create a class based off of it

  3. Within this class, create a build method:

from app import App

class Example(App):
    def build(self):
        pass
  1. Within this method, set the screen_width and screen_height attributes

  2. For a basic single layout interface, create a layout by first importing the layout type and then within the build method, create an object using the layout class as a variable NOTE: The only available layout at this time is the BoxLayout

  3. Once you have done this return the layout you have created:

from app import App
from Layouts.Box_Layout import BoxLayout

class Example(App):
    def build(self):
        self.screen_width = 400
        self.screen_height = 600

        my_layout = BoxLayout()
        
        return my_layout     
  1. The last step to successfully run your interface is to create a name == "main" if statement. Within this, create an object using the above class and call the run method on this object:
from app import App
from Layouts.Box_Layout import BoxLayout

class Example(App):
    def build(self):
        self.screen_width = 400
        self.screen_height = 600

        my_layout = BoxLayout()
        
        return my_layout     

if __name__ == "__main__":
    application = My_App()
    application.run()

Of course you will want to add widgets to your layout and potentially even additional layouts in the various layout configurations. This will be explained in upcoming wiki posts but can also be seen in the Test_Programs directory where there are numerous programs that illustrate the capabilities of the toolkit.

Clone this wiki locally