Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. import remi.gui as gui
  2. from remi import start, App
  3. import os
  4.  
  5. class MyApp(App):
  6.     def __init__(self, *args):
  7.         res_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'res')
  8.         #static_file_path can be an array of strings allowing to define
  9.         #  multiple resource path in where the resources will be placed
  10.         super(MyApp, self).__init__(*args, static_file_path=res_path)
  11.  
  12.     def idle(self):
  13.         #idle loop, you can place here custom code
  14.         # avoid to use infinite iterations, it would stop gui update
  15.         pass
  16.  
  17.     def main(self):
  18.         #creating a container GridBox type
  19.         main_container = gui.GridBox(width='100%', height='100%', style={'margin':'0px auto'})
  20.         #defining layout matrix
  21.         main_container.define_grid(['abbaaa',
  22.                                     'aacc',
  23.                                     'aaabbaa'])
  24.        
  25.         label = gui.Label('This is the a label')
  26.         label.style['background-color'] = 'green'
  27.        
  28.         button = gui.Button('Button')
  29.        
  30.         text = gui.TextInput()
  31.  
  32.         main_container.append(label,'abba')
  33.         main_container.append(button,'aa')
  34.         main_container.append(text,'cc')
  35.  
  36.         # returning the root widget
  37.         return main_container
  38.  
  39.  
  40. if __name__ == "__main__":
  41.     # starts the webserver
  42.     start(MyApp, address='127.0.0.1', port=8081, websocket_port=0, host_name=None, start_browser=True, username=None, password=None)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement