def main(self): # create "master" container which will hold top container and bottom container # We will add widgets to it vertically self.masterContainer = gui.Widget(1200, 50, gui.Widget.LAYOUT_VERTICAL, 10) # Create top container and then widgets will be added to it horizontally topContainer = gui.Widget(1200, 50, gui.Widget.LAYOUT_HORIZONTAL, 10) # Create bottom container self.bottomContainer = gui.Widget(1200, 0, gui.Widget.LAYOUT_HORIZONTAL, 0) # Create widgets that will be placed in the top container self.lbl = gui.Label(200, 30, 'Team name:') self.txt = gui.TextInput(200, 30) self.btn = gui.Button(200, 30, 'Submit') self.btn.set_on_click_listener(self, 'on_button_pressed') # Add those widgets to the top container topContainer.append('1', self.lbl) topContainer.append('2', self.txt) topContainer.append('3', self.btn) # At startup, we want to just add the top container to the master container self.masterContainer.append('1', topContainer) # At startup, make it so the textinput widget is ready to accept input self.txt.attributes['tabindex'] = "1" self.txt.attributes['autofocus'] = "autofocus" # return / render the master container return self.masterContainer
def main(self, name='world'): # the arguments are width - height - layoutOrientationHorizontal self.dyn_rec_client = None #self.wid = gui.Widget(DEFAULT_WIDTH+100, 1000, False, 20) self.wid = gui.Widget(-1, -1, gui.Widget.LAYOUT_VERTICAL, 20) #self.hor_servers = gui.Widget(500, 20, True, 10) #self.hor_servers = gui.Widget(-1, -1, gui.Widget.LAYOUT_HORIZONTAL, 20) self.hor_servers = gui.Widget(-1, -1, gui.Widget.LAYOUT_HORIZONTAL, 20) #self.bt = gui.Button(100, 30, 'Refresh list') self.bt = gui.Button(-1, -1, 'Refresh Dynamic Reconfigure Servers list') self.bt.set_on_click_listener(self, 'refresh_servers') self.hor_servers.append(1, self.bt) # This makes the button not be left self.bt.style['display'] = 'block' self.bt.style['margin'] = '10px auto' self.bt.style['float'] = 'none' self.refresh_servers() #self.hor_servers.style['padding-bottom'] = '20px' # returning the root widget return self.wid
def main(self): wid = gui.VBox(width='100%', margin='0px auto') width = '300' #'2048' height = '300' #'1152' self.video = gui.Widget(width=300, height=300, _type='video') self.video.attributes['autoplay'] = 'true' self.video.style['overflow'] = 'hidden' self.video.attributes['width'] = width self.video.attributes['height'] = height self.canvas = gui.Widget(_type='canvas') self.canvas.style['display'] = 'none' self.canvas.attributes['width'] = width self.canvas.attributes['height'] = height self.imgGrabber = ImageGrabber(self, width, height) self.imgGrabber.new_image.do(self.on_new_image) self.imgGrabber.onnewvideodevice.do(self.new_video_device) getVideoInputsButton = gui.Button("Get cameras", margin='10px') getVideoInputsButton.onclick.do(self.on_get_video_inputs) captureButton = gui.Button("Start", margin='10px') captureButton.onclick.do(self.on_start_grab, None) snapshotButton = gui.Button("Grab Image", margin='10px') snapshotButton.onclick.do(self.snapshot) self.check_flash = gui.CheckBoxLabel('Flashlight', False, width=200, height=30, margin='10px') self.check_flash.set_on_change_listener(self.on_start_grab) self.label = gui.Label('Image capture') self.label.style['font-size'] = '18px' self.device_list = gui.DropDown(width=100) wid.append(self.label) wid.append(self.video) wid.append(self.canvas) wid.append(getVideoInputsButton) wid.append(self.device_list) wid.append(captureButton) wid.append(snapshotButton) wid.append(self.check_flash) self.opencvVideoWidget = OpencvVideoWidget(self, width=400, height=300) wid.append( gui.VBox( children=[gui.Label("opencv image"), self.opencvVideoWidget], style={'bolder': '1px dotted black'})) wid.add_child("javascript_image_grabber", self.imgGrabber) self.dialog = None # returning the root widget return wid
def main(self): # the arguments are width - height - layoutOrientationOrizontal self.main_container = gui.Widget(margin='0px auto') self.main_container.set_size(1020, 600) self.main_container.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL) self.title = gui.Label('Mine Field GAME') self.title.set_size(1000, 30) self.title.style['margin'] = '10px' self.title.style['font-size'] = '25px' self.title.style['font-weight'] = 'bold' self.info = gui.Label('Collaborative minefiled game. Enjoy.') self.info.set_size(400, 30) self.info.style['margin'] = '10px' self.info.style['font-size'] = '20px' self.lblMineCount = gui.Label('Mines') self.lblMineCount.set_size(100, 30) self.lblFlagCount = gui.Label('Flags') self.lblFlagCount.set_size(100, 30) self.time_count = 0 self.lblTime = gui.Label('Time') self.lblTime.set_size(100, 30) self.btReset = gui.Button('Restart') self.btReset.set_size(100, 30) self.btReset.onclick.connect(self.new_game) self.horizontal_container = gui.Widget() self.horizontal_container.style['display'] = 'block' self.horizontal_container.style['overflow'] = 'auto' self.horizontal_container.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL) self.horizontal_container.style['margin'] = '10px' self.horizontal_container.append(self.info) imgMine = gui.Image('/res/mine.png') imgMine.set_size(30, 30) self.horizontal_container.append([imgMine, self.lblMineCount]) imgFlag = gui.Image('/res/flag.png') imgFlag.set_size(30, 30) self.horizontal_container.append([imgFlag, self.lblFlagCount, self.lblTime, self.btReset]) self.minecount = 0 # mine number in the map self.flagcount = 0 # flag placed by the players self.link = gui.Link("https://github.com/dddomodossola/remi", "This is an example of REMI gui library.") self.link.set_size(1000, 20) self.link.style['margin'] = '10px' self.main_container.append([self.title, self.horizontal_container, self.link]) self.new_game(self) self.display_time() # returning the root widget return self.main_container
def main(self): container = gui.VBox(width=800, height=400) self.lb_version = gui.Label('Version:') self.lb_tc = gui.Label('Traffic Class:') self.lb_fl = gui.Label('Flow Label:') self.lb_pl = gui.Label('Payload Length:') self.lb_nh = gui.Label('Next Header:') self.lb_sa = gui.Label('Source Address:') self.lb_da = gui.Label('Destination Address:') self.txt = gui.TextInput(width=200, height=30, margin='10px') self.bt_send = gui.Button('Send') self.bt_defaut_value = gui.Button('default value') self.bt_reset = gui.Button('reset value') # setting the listener for the onclick event of the button self.bt_send.onclick.connect(self.on_button_pressed) self.bt_defaut_value.onclick.connect(self.on_button_pressed2) # appending a widget to another, the first argument is a string key horizontalContainer = gui.Widget( width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px', style={ 'display': 'block', 'overflow': 'auto' }) subContainerLeft = gui.Widget(width=540, margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) subContainerLeft.append([ self.lb_version, self.lb_tc, self.lb_fl, self.lb_pl, self.lb_nh, self.lb_sa, self.lb_da ]) subContainerRight = gui.Widget(width=540, margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) subContainerRight.append( [self.bt_send, self.bt_defaut_value, self.bt_reset]) horizontalContainer.append([subContainerLeft, subContainerRight]) container.append([horizontalContainer]) container.append(self.txt) container.append(self.bt_send) container.append(self.bt_defaut_value) container.append(self.bt_reset) # returning the root widget return container
def main(self, name='world'): # the arguments are width - height - layoutOrientationOrizontal self.wid = gui.Widget(800, 800, False, 10) self.hor_topics = gui.Widget(-1, -1, gui.Widget.LAYOUT_HORIZONTAL, 20) # Refresh topics self.bt = gui.Button(-1, -1, 'Refresh topics list') self.bt.set_on_click_listener(self, 'refresh_topics') # List non-compressed topics checkbox self.check_raw_topics = False self.checkbox = gui.CheckBoxLabel(200, 30, label='Show raw topics', checked=False) self.checkbox.set_on_change_listener(self, 'change_raw_topics') # Stop/Play button self.playing = False self.bt_pause = gui.Button(-1, -1, 'Stop video') self.bt_pause.set_on_click_listener(self, 'pause_play') self.hor_topics.append(1, self.bt) self.hor_topics.append(2, self.checkbox) # This makes the button not be left self.bt.style['display'] = 'block' self.bt.style['margin'] = '10px auto' self.bt.style['float'] = 'none' self.rosvideo_widget = None # Dropdown of topics self.refresh_topics() # Pause button self.hor_topics.append(4, self.bt_pause) self.bt_pause.style['display'] = 'block' self.bt_pause.style['margin'] = '10px auto' self.bt_pause.style['float'] = 'none' # Dropdown of topic FPS #TODO: self.fps = 20 # Put the Widget already or it gives problem to put it dynamically self.rosvideo_widget = CompressedImageVideoWidget(400, 400, fps=self.fps) self.wid.append(2, self.rosvideo_widget) rospy.loginfo("Finished initialization.") # returning the root widget return self.wid
def nutrients_clicked(self, widget): nutrients_setpoints = self.read_from_pickle("nutrients_setpoints") ph_value = self.read_from_pickle("ph_sensor") self.nutrients_control = gui.GenericDialog(title='Nutrient Control', width='100%', height='100%') nutrients_container = gui.Widget(width='100%', height='100%', margin='0px auto', style={ 'text-align': 'center', 'display': 'block', 'overflow': 'auto' }) self.ph_label = gui.Label('pH setpoint: ' + str(nutrients_setpoints['ph']), width='100%', height=30, margin='0px') self.ph_slider = gui.Slider(nutrients_setpoints['ph'], 0, 14, 0.25, width='80%', height=30, margin='20px') self.ph_slider.onchange.do(self.ph_slider_changed) self.ph_sensor_label = gui.Label('current reservoir pH: ', width='100%', height=30, margin='0px') spacer = gui.Widget(width='100%', height=75, margin='0px auto', style={ 'display': 'block', 'overflow': 'auto' }) spacer_label = gui.Label('', width='100%', height=20, margin='0px') nutrients_container.append([ spacer_label, self.ph_label, self.ph_slider, self.ph_sensor_label, spacer ]) self.nutrients_control.add_field("nutrients", nutrients_container) self.nutrients_control.confirm_dialog.do(self.nutrients_confirm) self.ph_sensor_label.set_text("current reservoir pH: " + str(ph_value["ph"])) self.nutrients_control.show(self)
def do_tlx(self, widget, user, type_): self.dialog = gui.GenericDialog( title="NASA-TLX", message= f"NASA Task Load Index for the {type_.name} view experiment performed by {user.name}. How much did each component contribute to your task load? (scale from 0 to 20)", width="600px") for component in self.tlx.components.values(): self.dialog.add_field( component.code, gui.Label(f"{component.name}: {component.description}", margin="10px")) slider = gui.Slider(component.score, 0, 20, 1, width="80%") slider.set_oninput_listener(self.tlx_slider_changed, component.code) slider_value = gui.Label(slider.get_value(), margin="10px") self.tlx_sliders[component.code] = (slider, slider_value) box = gui.Widget(width="100%", layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, height=50) box.append(slider_value) box.append(slider) self.dialog.add_field(component.code + "_score", box) self.dialog.set_on_confirm_dialog_listener(self.tlx_done, user, type_) self.dialog.show(self)
def main(self, name='world'): # the arguments are width - height - layoutOrientationOrizontal wid = gui.Widget(640, 270, False, 10) self.image_widget = PILImageViewverWidget(200, 200) self.menu = gui.Menu(620, 30) m1 = gui.MenuItem(100, 30, 'File') m11 = gui.MenuItem(100, 30, 'Save') m12 = gui.MenuItem(100, 30, 'Open') m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem(100, 30, 'Save') m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem(100, 30, 'Save as') m112.set_on_click_listener(self, 'menu_saveas_clicked') self.menu.append('1', m1) m1.append('11', m11) m1.append('12', m12) m11.append('111', m111) m11.append('112', m112) wid.append('0', self.menu) wid.append('1', self.image_widget) # returning the root widget return wid
def __init__(self, appInstance, **kwargs): super(UrlPathInput, self).__init__(**kwargs) gui.EventSource.__init__(self) self.appInstance = appInstance self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL) self.style['display'] = 'block' self.style['overflow'] = 'hidden' self.txtInput = StringEditor(width='80%', height='100%') self.txtInput.style['float'] = 'left' self.txtInput.onchange.connect(self.on_txt_changed) self.append(self.txtInput) self.btFileFolderSelection = gui.Widget(width='20%', height='100%') self.btFileFolderSelection.style.update({ 'background-repeat': 'round', 'background-image': "url('/res/folder.png')", 'background-color': 'transparent' }) self.append(self.btFileFolderSelection) self.btFileFolderSelection.onclick.connect( self.on_file_selection_bt_pressed) self.selectionDialog = gui.FileSelectionDialog('Select a file', '', False, './', True, False) self.selectionDialog.confirm_value.connect(self.file_dialog_confirmed)
def __init__(self, appInstance, **kwargs): super(UrlPathInput, self).__init__(**kwargs) self.appInstance = appInstance self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL) self.style['display'] = 'block' self.style['overflow'] = 'hidden' self.txtInput = gui.TextInput(True, width='80%', height='100%') self.txtInput.style['float'] = 'left' self.txtInput.set_on_change_listener(self, "on_txt_changed") self.append(self.txtInput) self.btFileFolderSelection = gui.Widget(width='20%', height='100%') self.btFileFolderSelection.style['background-repeat'] = 'round' self.btFileFolderSelection.style[ 'background-image'] = "url('/res/folder.png')" self.btFileFolderSelection.style['background-color'] = 'transparent' self.append(self.btFileFolderSelection) self.btFileFolderSelection.set_on_click_listener( self, 'on_file_selection_bt_pressed') self.selectionDialog = gui.FileSelectionDialog('Select a file', '', False, './', True, False) self.selectionDialog.set_on_confirm_value_listener( self, 'file_dialog_confirmed')
def main(self, name='world'): # Add the widget, it's the white background # self is for making the widget part of the class to be able to modify it self.wid = gui.Widget(400, 300, False, 10) # To make it prettier put a tittle of what is this demo self.tittle_label = gui.Label(350, 20, "Dynamical layout change demo") self.description_label = gui.Label(350, 80, """Choose from the dropdown a widget and it will be added to the interface. If you change the dropdown selection it will substitute it.""") # Create dropdown and it's contents self.dropdown = gui.DropDown(200, 20) choose_ddi = gui.DropDownItem(200, 20, "Choose...") button_ddi = gui.DropDownItem(200, 20, "Add button") label_ddi = gui.DropDownItem(200, 20, "Add label") self.dropdown.append('0', choose_ddi) self.dropdown.append('1', button_ddi) self.dropdown.append('2', label_ddi) # Add a listener self.dropdown.set_on_change_listener(self, 'on_dropdown_change') # Add the dropdown to the widget self.wid.append('0', self.tittle_label) self.wid.append('1', self.description_label) self.wid.append('2', self.dropdown) # returning the root widget return self.wid
def main(self, name='world'): # the arguments are width - height - layoutOrientationOrizontal self.mainContainer = gui.Widget(width=640, height=270, margin='0px auto') self.mainContainer.style['text-align'] = 'center' self.image_widget = PILImageViewverWidget(width=200, height=200) self.menu = gui.Menu(width=620, height=30) m1 = gui.MenuItem('File', width=100, height=30) m11 = gui.MenuItem('Save', width=100, height=30) m12 = gui.MenuItem('Open', width=100, height=30) m12.onclick.do(self.menu_open_clicked) m111 = gui.MenuItem('Save', width=100, height=30) m111.onclick.do(self.menu_save_clicked) m112 = gui.MenuItem('Save as', width=100, height=30) m112.onclick.do(self.menu_saveas_clicked) self.menu.append(m1) m1.append(m11) m1.append(m12) m11.append(m111) m11.append(m112) self.mainContainer.append(self.menu) self.mainContainer.append(self.image_widget) # returning the root widget return self.mainContainer
def main(self): # the margin 0px auto centers the main container verticalContainer = gui.Widget(width=540, margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) info_bt = gui.Button('Show info dialog', width=200, height=30, margin='10px') error_bt = gui.Button('Show error dialog', width=200, height=30, margin='10px') # setting the listener for the onclick event of the button info_bt.set_on_click_listener(self.show_info_dialog) error_bt.set_on_click_listener(self.show_error_dialog) verticalContainer.append(info_bt) verticalContainer.append(error_bt) # returning the root widget return verticalContainer
def main(self, name='world'): # the arguments are width - height - layoutOrientationOrizontal wid = gui.Widget(width=640, height=270) wid.style['text-align'] = 'center' self.image_widget = PILImageViewverWidget(width=200, height=200) self.menu = gui.Menu(width=620, height=30) m1 = gui.MenuItem('File', width=100, height=30) m11 = gui.MenuItem('Save', width=100, height=30) m12 = gui.MenuItem('Open', width=100, height=30) m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem('Save', width=100, height=30) m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem('Save as', width=100, height=30) m112.set_on_click_listener(self, 'menu_saveas_clicked') self.menu.append(m1) m1.append(m11) m1.append(m12) m11.append(m111) m11.append(m112) wid.append(self.menu) wid.append(self.image_widget) # returning the root widget return wid
def _analysis_page(self): """ This function defines the structure of the analysis page of the web application. :return: The root remi.gui.Widget object for the analysis page. """ # Define root widget. main_container = gui.Widget(width='100%', style={ 'vertical-align': 'top', 'align-content': 'center' }) # Define title and instructions text. analysis_title = wc.h2('Analysis') analysis_title.style['text-align'] = 'center' analysis_instructions = wc.h4( 'Once a model and/or data set has been loaded. This page can be used to see model' 'hyperparameters and data set properties (such as number of dimensions), and ' 'to visualise the data and model latent spaces and hyperparameters.' ) analysis_instructions.style['text-align'] = 'justify-all' # # Add MatplotlibFigure widget. # self.mpl = wc.MatplotlibFigure(width=250, height=250) # self.mpl.ax.set_title('Test') # self.mpl.ax.scatter(np.linspace(0, 1, 25), np.random.standard_normal(25)) # self.mpl.redraw() # Build up the webpage. main_container.append( [self.nav_bar, analysis_title, analysis_instructions, self.footer]) # Return the root widget. return main_container
def construct_tabview(self): # make tab bar as wide as the frame if self.bar_width < self.frame_width: blank_width = self.frame_width - self.bar_width but = gui.Button('', width=blank_width, height=self.bar_height) self.tab_bar.append(but, key='xxblank') self.bar_width = self.frame_width self.tab_bar.style['width'] = gui.to_pix(self.bar_width) self.tab_title = gui.Label('fred', width=self.frame_width - 30, height=20) self.tab_title.style['margin'] = '2px' # frame for the tab panel, different tabs are switched into this frame. self.tab_frame = gui.Widget(width=self.frame_width, height=self.frame_height) #0 self.tab_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL) # add the bar, panels and title to the subclassed Widget self.append(self.tab_bar, key='tab_bar') self.append(self.tab_title, key='tab_title') self.append(self.tab_frame, key='tab_frame') self.set_size(self.bar_width, self.frame_height + 100) return self
def main(self): wid = gui.HBox() wid.style['position'] = 'absolute' ctrl = gui.VBox(width=400) ctrl.style['justify-content'] = 'space-around' plotContainer = gui.Widget() plt = PlotlyWidget(data=self.data, id='plot') self.plt = plt plotContainer.append(plt) self.historyBox = LabelSpinBox(default_value=100, min=1, max=10000000, step=1, label='history') lbl = gui.Label('GUI') bt = gui.Button('Start', width=200, height=30) bt.style['margin'] = 'auto 50px' bt.style['background-color'] = 'green' self.started = False # setting the listener for the onclick event of the button bt.set_on_click_listener(self.on_button_pressed, ctrl) ctrl.append(lbl) ctrl.append(self.historyBox) ctrl.append(bt) # returning the root widget wid.append(ctrl) wid.append(plotContainer) return wid
def main(self): vertContainer = gui.Widget( width='80%', layout_orientation=gui.Widget.LAYOUT_VERTICAL, margin='0px auto', style={ 'display': 'block', 'overflow': 'auto', 'background-color': '#BEBEBE' }) vertContainer.style['text-align'] = 'center' vertContainer.style['align-items'] = 'center' vertContainer.style['justify-content'] = 'center' wid = gui.VBox(width=300, height=200, margin='0px auto') self.lbl1 = gui.Label('bottom text') self.lbl1.style['margin'] = 'auto' wid.append(self.lbl1) self.img = gui.Image('/res/wildcat.png', height=150, margin='0px auto') b1 = gui.Button('Add new tab', width=200, height=30) b2 = gui.Button('Show third tab', width=200, height=30) b3 = gui.Button('Show first tab', width=200, height=30) tb = gui.TabBox(width='100%') tb.add_tab([b1, b2], 'First', None) b1.set_on_click_listener(self.on_bt1_pressed, tb, 0) b2.set_on_click_listener(self.on_bt2_pressed, tb, 0) vertContainer.append(tb) return vertContainer
def _model_page(self): # Define root widget. main_container = gui.Widget(width='100%', style={ 'vertical-align': 'top', 'align-content': 'center' }) # Define title and instructions text. models_title = wc.h2('Bayesian Non-Parametric Models') models_title.style['text-align'] = 'center' models_instructions = wc.h4( 'Choose a model from the pulldown menu. Afterwards, the user can choose to load a ' 'existing model trained for a specific data set to visualise results and generate ' 'data from the model. Or the user can train a new model by (1) setting model ' 'hyperparameters, (2) choosing a data set, and (3) setting experiment parameters.' ) models_instructions.style['text-align'] = 'justify-all' # Define row container for model selection. selection_container = gui.HBox(width='50%', margin='auto', style={ 'display': 'block', 'overflow': 'auto', 'align-content': 'center', 'margin-top': '50px' }) model_label = wc.h5('Model: ') model_label.style['margin-top'] = '8px' # Define drop down with different models. self.model_dropdown = gui.DropDown(width='250px', style={'margin-right': '15px'}) self.model_dropdown.add_class("form-control dropdown") self.model_dropdown.append( dict( zip(self.models, [gui.DropDownItem(model_str) for model_str in self.models]))) self.model_select_button = gui.Button('Select', width='100px', style={'box-shadow': 'none'}) self.model_select_button.add_class('btn btn-primary') self.model_select_button.onclick.connect( self.select_button_clicked) # Listener function for mouse click. # Build up the webpage. selection_container.append( [model_label, self.model_dropdown, self.model_select_button]) main_container.append([ self.nav_bar, models_title, models_instructions, selection_container, self.footer ]) # Return the root widget. return main_container
def initCamera(self): cameraBox = self.sectionBox() videoChoiceBox = gui.HBox(gui.Label('Video Feeds')) cameraBox.append(videoChoiceBox) for camera in ['Limelight', 'Camera 2', 'Camera 3']: button = gui.Button(camera) button.onclick.connect(self.c_switchVideoFeed) videoChoiceBox.append(button) staticBox = gui.Widget() staticBox.set_size(640, 240) cameraBox.append(staticBox) relativeBox = gui.Widget() relativeBox.style["position"] = "relative" relativeBox.style["top"] = "0px" relativeBox.style["left"] = "0px" staticBox.append(relativeBox) self.videoFeed = gui.Image('http://10.26.5.6:5800/') self.videoFeed.style["top"] = "0px" self.videoFeed.style["left"] = "0px" self.videoFeed.style["position"] = "absolute" self.videoFeed.style["z-index"] = "1" relativeBox.append(self.videoFeed) self.setVideoFeed(0) horizLine = gui.Widget() horizLine.set_size(CROSSHAIR_SIZE, CROSSHAIR_WIDTH) horizLine.style["background"] = "#66FF00" horizLine.style["left"] = str(CROSSHAIR_X - CROSSHAIR_SIZE / 2) + "px" horizLine.style["top"] = str(CROSSHAIR_Y - CROSSHAIR_WIDTH / 2) + "px" horizLine.style["position"] = "absolute" horizLine.style["z-index"] = "2" relativeBox.append(horizLine) vertLine = gui.Widget() vertLine.set_size(CROSSHAIR_WIDTH, CROSSHAIR_SIZE) vertLine.style["background"] = "#66FF00" vertLine.style["left"] = str(CROSSHAIR_X - CROSSHAIR_WIDTH / 2) + "px" vertLine.style["top"] = str(CROSSHAIR_Y - CROSSHAIR_SIZE / 2) + "px" vertLine.style["position"] = "absolute" vertLine.style["z-index"] = "2" relativeBox.append(vertLine) return cameraBox
def main(self): # the arguments are width - height - layoutOrientationOrizontal self.main_container = gui.Widget(1020, 600, False, 10) self.title = gui.Label(1000, 30, 'Mine Field GAME') self.title.style['font-size'] = '25px' self.title.style['font-weight'] = 'bold' self.info = gui.Label(400, 30, 'Collaborative minefiled game. Enjoy.') self.info.style['font-size'] = '20px' self.lblMineCount = gui.Label(100, 30, 'Mines') self.lblFlagCount = gui.Label(100, 30, 'Flags') self.time_count = 0 self.lblTime = gui.Label(100, 30, 'Time') self.btReset = gui.Button(100, 30, 'Restart') self.btReset.set_on_click_listener(self, "new_game") self.horizontal_container = gui.Widget(1000, 30, True, 0) self.horizontal_container.append('info', self.info) self.horizontal_container.append('icon_mine', gui.Image(30, 30, '/res/mine.png')) self.horizontal_container.append('info_mine', self.lblMineCount) self.horizontal_container.append('icon_flag', gui.Image(30, 30, '/res/flag.png')) self.horizontal_container.append('info_flag', self.lblFlagCount) self.horizontal_container.append('info_time', self.lblTime) self.horizontal_container.append('reset', self.btReset) self.minecount = 0 #mine number in the map self.flagcount = 0 #flag placed by the players self.link = gui.Link(1000, 20, "https://github.com/dddomodossola/remi", "This is an example of REMI gui library.") self.main_container.append('title', self.title) self.main_container.append('horizontal_container', self.horizontal_container) self.main_container.append('link', self.link) self.new_game() self.display_time() # returning the root widget return self.main_container
def main(self): self.users = [] self.save_location = "data.pickle" container = gui.Widget(width=500, margin="0px auto") menu = gui.Menu(width="100%", height="30px") menu_file = gui.MenuItem("File", width=100, height=30) menu_load = gui.MenuItem("Load...", width=100, height=30) menu_load.set_on_click_listener(self.cbk_select_pickle) menu_save = gui.MenuItem("Save", width=100, height=30) menu_save.set_on_click_listener(self.cbk_save) menu_save_as = gui.MenuItem("Save As...", width=100, height=30) menu_save_as.set_on_click_listener(self.cbk_save_as) menu.append(menu_file) menu_file.append(menu_load) menu_file.append(menu_save) menu_file.append(menu_save_as) menubar = gui.MenuBar(width="100%", height="30px") menubar.append(menu) self.uploader = gui.FileUploader("./", margin="10px") self.uploader.set_on_success_listener(self.cbk_load) self.save_location_label = gui.Label(f"Saving to {self.save_location}", margin="10px") self.table = gui.Table.new_from_list([("ID", "Name", "Onboard", "SPIRIT", "Both")], width=300, margin="10px") select_user_label = gui.Label("Select a user:"******"10px") self.user_list = gui.ListView(margin="10px", width=300) self.user_list.set_on_selection_listener(self.cbk_user_selected) add_user_button = gui.Button("Add user", width=200, height=30, margin="10px") add_user_button.set_on_click_listener(self.cbk_add_user) save_button = gui.Button("Save", width=200, height=30, margin="10px") save_button.set_on_click_listener(self.cbk_save) try: self._load(self.save_location) except FileNotFoundError: pass self.update_table() self.update_user_list() container.append(menubar) container.append(self.uploader) container.append(self.save_location_label) container.append(self.table) container.append(select_user_label) container.append(self.user_list) container.append(add_user_button) container.append(save_button) return container
def menu_index_clicked(self, widget): self.main_frame = gui.Widget(width='100%', margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) pass
def get_chart(self): chart = gui.Widget(_type='iframe', **self.chart_args) chart.attributes['width'] = '100%' chart.attributes['height'] = '100%' chart.attributes['controls'] = 'true' chart.style['border'] = 'none' return chart
def video_widgets(self): width = '300' height = '300' self.video = gui.Widget(_type='video') self.video.style['overflow'] = 'hidden' self.video.attributes['autoplay'] = 'true' self.video.attributes['width'] = width self.video.attributes['height'] = height
def __init__(self, *args): self.main_frame = gui.Widget(width='100%', margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) super(MyApp, self).__init__(*args)
def main(self): # creating a container VBox type, vertical (you can use also HBox or Widget) self.main_container = gui.Widget(width="50%", height=200, style={'margin': '0px auto'}) # returning the root widget return self.main_container
def main(self): # the margin 0px auto centers the main container verticalContainer = gui.Widget(width=540, margin='0px auto', style={ 'display': 'block', 'overflow': 'hidden' }) horizontalContainer = gui.Widget( width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px', style={ 'display': 'block', 'overflow': 'auto' }) subContainerLeft = gui.Widget(width=320, style={ 'display': 'block', 'overflow': 'auto', 'text-align': 'center' }) self.img = gui.Image('/res:logo.png', height=100, margin='10px') self.img.onclick.connect(self.on_img_clicked) self.uptext = gui.Label('识别应用场景') self.bt_tableocr = gui.Button('表格识别', width=200, height=30, margin='10px') self.bt_tableocr.onclick.connect(self.goto_tableocr_web) self.bt_tableocr = gui.Button('文档识别', width=200, height=30, margin='10px') self.bt_tableocr.onclick.connect(self.goto_dococr_web) # this flag will be used to stop the display_counter Timer self.stop_flag = False # returning the root widget return verticalContainer
def main(self, name='world'): self.wid = gui.Widget() self.wid.set_size(620, 620) self.gauge = InputGauge(200, 200, 1000, 10000) self.wid.append(self.gauge) # returning the root widget return self.wid