def setup_player_gui(self, player): """ Sets up player-related GUI that requires a player before setting up. """ # Set up health and power bars health_bar_rect = ogre.Rectangle() health_bar_rect.left = self.viewport.actualWidth / 2 - 128 health_bar_rect.top = self.viewport.actualHeight - 84 health_bar_rect.right = health_bar_rect.left + 256 health_bar_rect.bottom = health_bar_rect.top + 10 health_bar = gui.StatusBar("UI/StatusBars/Health", health_bar_rect, player.max_health) health_bar.name = "Health" power_bar_rect = ogre.Rectangle() power_bar_rect.left = health_bar_rect.left power_bar_rect.top = health_bar_rect.bottom power_bar_rect.right = health_bar_rect.right power_bar_rect.bottom = power_bar_rect.top + 10 power_bar = gui.StatusBar("UI/StatusBars/Power", power_bar_rect, player.max_power) power_bar.name = "Power" # Add the gui elements to the element list. self.elements.append(health_bar) self.elements.append(power_bar) # Add listeners to player's health and power changed events. player.health_changed += health_bar.on_value_changed player.power_changed += power_bar.on_value_changed self.setup_ability_bar(player)
def setupGUI(self): # Set up health and power bars health_bar_rect = ogre.Rectangle() health_bar_rect.left = self.viewport.actualWidth / 2 - 128 health_bar_rect.top = self.viewport.actualHeight - 84 health_bar_rect.right = health_bar_rect.left + 256 health_bar_rect.bottom = health_bar_rect.top + 10 health_bar = gui.StatusBar("UI/StatusBars/Health", health_bar_rect, self.player.max_health) health_bar.name = "Health" power_bar_rect = ogre.Rectangle() power_bar_rect.left = health_bar_rect.left power_bar_rect.top = health_bar_rect.bottom power_bar_rect.right = health_bar_rect.right power_bar_rect.bottom = power_bar_rect.top + 10 power_bar = gui.StatusBar("UI/StatusBars/Power", power_bar_rect, self.player.max_power) power_bar.name = "Power" # Add the gui elements to the element list. self.gui_elements.append(health_bar) self.gui_elements.append(power_bar) # Add listeners to player's health and power changed events. self.player.health_changed += health_bar.on_value_changed self.player.power_changed += power_bar.on_value_changed # Create an FPS label. fpslabel = gui.FPSLabel("UI/FPSLabel") self.gui_elements.append(fpslabel) # Set up the ability bar. self.setupGUIAbilityBar()
left='17', top=nTop, width='238', filename='sistemas-agiles.png', ) gui.Image( name='imgpyafip', height='50', left='665', top=nTop, width='100', filename='logo-pyafipws.png', ) gui.StatusBar( name='statusbar_15_91', text=u'Servicio Web Factura Electr\xf3nica mercado interno (WSFEv1)', ) # --- gui2py designer generated code ends --- mywin = gui.get("buscapadron") panel = mywin['panelbusqueda'] panel['imgsistema'].top = str(int(mywin.height[:-2]) - 50) panel['imgpyafip'].top = str(int(mywin.height[:-2]) - 80) def main(): mywin.show() if __name__ == "__main__":
# subject gui.Label(name='label_subject', left='10', top='116', parent='mywin.notebook.tab_message', text='Subject') gui.TextBox(name='subject', left='80', top='116', width='150', parent='mywin.notebook.tab_message', value='LMS MMS Subject') # message gui.Label(name='label_message', left='10', top='142', parent='mywin.notebook.tab_message', text='Message') gui.TextBox(name='message', left='80', top='142', width='150', height='150', parent='mywin.notebook.tab_message', value=u'메시지를 입력하세요', multiline=True) gui.Label(name='label_image', left='10', top='306', parent='mywin.notebook.tab_message', text='Image') gui.Button(label='File', name='choose_image', left='80', top='300', width='85', default=True, parent='mywin.notebook.tab_message', onclick=ui.choose_image) gui.TextBox(name='filename', left='166', top='301', parent='mywin.notebook.tab_message', value='') # buttons gui.Button(label='Send', name='send', left='80', top='326', width='85', default=True, parent='mywin.notebook.tab_message') gui.StatusBar(name='statusbar', parent='mywin') #### list #### gui.Label(name='label_page', left='10', top='5', parent='mywin.notebook.tab_list', text='Page : 0/0') gui.Button(label='Prev', name='prev', left='100', top='5', width='85', default=True, parent='mywin.notebook.tab_list', onclick=ui.refresh_prev) gui.Button(label='Next', name='next', left='190', top='5', width='85', default=True, parent='mywin.notebook.tab_list', onclick=ui.refresh_next) gui.Button(label='Refresh', name='refresh', left='290', top='5', width='85', default=True, parent='mywin.notebook.tab_list', onclick=ui.refresh_status) gui.ListView(name='listview', height='320', left='0', top='30', width='590', item_count=27, parent='mywin.notebook.tab_list', sort_column=0, onitemselected="print ('sel %s' % event.target.get_selected_items())", ) gui.ListColumn(name='col_accepted_time', text='Date', parent='listview', ) gui.ListColumn(name='col_callno', text='Phone Number', parent='listview', ) gui.ListColumn(name='col_status', text='Status', width=20, parent='listview', ) gui.ListColumn(name='col_resultcode', text='Result Code', width=26, parent='listview', ) gui.ListColumn(name='col_resultmessage', text='Result Message', parent='listview', ) gui.ListColumn(name='col_sent_time', text='Sent time', parent='listview', )
updaterects = [] stagehover_urects = [] import tiles import gui import saveload ########## initial drawing/setup of gui elements ########## pygame.display.set_caption('5bedit') pygame.display.set_icon(gui.load_sprite('windowicon')) stage = gui.Stage(lvl, lvloverlap, 0, tile_s) stage_rect = pygame.Rect(tray_w, 0, stage_w, stage_h) statusbar = gui.StatusBar(w=statusbar_w, h=statusbar_h, margin=2, font='Courier', fontsize=14, text='current tile: \'%s\'' % current, rtext='') statusbar_rect = screen.blit(statusbar.render(), (0, stage_h)) tiletray = gui.tiletray tray_rect = screen.blit(tiletray.render(), (0, 0)) screen.blit(stage.render_full(), (stage_rect.x, stage_rect.y)) pygame.draw.rect(screen, (37, 37, 37), (0, 0, tray_w, stage_h)) screen.blit(statusbar.render(), (0, stage_h)) screen.blit(tiletray.render(), (0, 0)) pygame.display.update() # rect corresponding to tiles in the level def tile_rect(i, j, rx, ry, rw, rh): return pygame.Rect(i*tile_s - stage.cx + stage_rect.left + rx*tile_s,