def __init__(self, screen): self.gameManager = None # required, but dependency cycle self.log = logging.getLogger(type(self).__name__) super().__init__() container = gui.Container() # Setup the 'game' area where the action takes place self.gameArea = DrawingArea(screen.get_width(), self.gameAreaHeight) # Setup the gui area self.menuArea = gui.Container(width=screen.get_width(), height=screen.get_height() - self.gameAreaHeight) tabel = gui.Table(height=screen.get_height()) tabel.tr() tabel.td(self.gameArea) tabel.tr() tabel.td(self.menuArea) container.add(tabel, 0, 0) self.init(container, screen) # create board self.log.debug("Creating game board") Size = namedtuple('Size', ['width', 'height']) from board import Renderer self.boardFunction = Renderer( Size(self.gameArea.rect.width, self.gameArea.rect.height)).render # a function self.log.debug("Creating font") self.font = pygame.font.SysFont("", 16)
def __init__(self, bckg="None", port=None, **params): self.bckg = bckg self.port = port title = gui.Label("Setting sensor for port %d" % int(self.port)) self.value = gui.Form() self.container = gui.Container() table = gui.Table() table.tr() self.sensors_img = gui.Image(p('icons/sensors.jpg')) table.td(self.sensors_img, cellspan=3) spacer = gui.Spacer(200, 100) self.box = gui.ScrollArea(spacer) table.tr() table.td(self.box, style={'border': 1}) save = gui.Button('Save') save.connect(gui.CLICK, self.send, gui.CHANGE) table.tr() table.td(save, align=1) self.container.add(table, 0, 0) self.init_ports() self.change() gui.Dialog.__init__(self, title, self.container)
def __init__(self, system, instance = None): self.instance = instance self.container = pgui.Container(width=350, height =600) self.position=1550,80 self.system = system self.lines = [] self.update_recursion(self.system)
def __init__(self, ship = None): self.ship = ship self.container = pgui.Container(width=300, height=100) self.position = 15,945 #List of 3 null slots self.item_slot = {} self.button_group = pgui.Group() for i in range(4): button = pgui.Radio(self.button_group, i, width=100, height=100) button.style.width = 128 button.style.height= 128 button.focusable = False self.container.add(button, i * 143, 0) self.item_slot[i] = None self.__setattr__("button%s" % i, button) # def switch_weapon(value): # key = value.value # if self.ship is not None: # self.ship.weapon = self.weapon_slot[key] # # self.button_group.connect(pgui.CHANGE, switch_weapon, self.button_group) self.update()
def __init__(self, ship=None, system=None): self.ship = ship self.system = system self.position = 1500, 705 self.container = pgui.Container(width=300, height=100) # any fixed value works self.minimap_icon = pgui.Image(texture["minimap"]) self.container.add(self.minimap_icon, 0 ,0) self.targets = [] self.button = pgui.Image(texture["minimap_button"]) def button_code(value): print("pressed! minimap button") self.button.connect(pgui.CLICK, button_code, None) self.container.add(self.button, 285,232) self.last_velocity=-1 blank_velocity_surface = pygame.Surface((90,263)) self.velocity_shader = pgui.Image(blank_velocity_surface) self.container.add(self.velocity_shader, 7, 37) self.mode = self.GLOBAL self. map_surface = pgui.Image(pygame.Surface((320,320),pygame.SRCALPHA,32)) self.container.add(self.map_surface, 44,7) self.update()
def __init__(self, instance = None, ship = None): class Fake_It_Till_You_Make_It: day = 0 scrap = 0 influence = 0 fuel = 160 max_fuel = 200 if instance is None: instance = Fake_It_Till_You_Make_It() if ship is None: ship = Fake_It_Till_You_Make_It() self.last_fuel=-1 self.ship = ship self.instance = instance self.container = pgui.Container(width=300, height=100) self.position = 1920-720, 0 self.container.add(pgui.Image(texture["stat_block_background"]), 0,0) self.label_date = pgui.Label("") blank_fuel_surface = pygame.Surface((256,74)) self.label_fuel = pgui.Image(blank_fuel_surface) self.label_influence = pgui.Label("") self.label_scrap = pgui.Label("") self.label_date.set_font(font["ui_font_2"]) self.label_influence.set_font(font["ui_font_2"]) self.label_scrap.set_font(font["ui_font_2"]) self.container.add(self.label_date, 360, 16) self.container.add(self.label_fuel, 375, 75) self.container.add(self.label_influence, 590, 16) self.container.add(self.label_scrap, 190, 16) self.update()
def __init__(self, bckg = "None"): self.bckg = bckg title = gui.Label("Set background") self.value = gui.Form() self.container = gui.Container() table = gui.Table() table.tr() table.td(self.build_background_select(), style={'padding_top': 10, 'padding_bottom': 10}) save = gui.Button('Save') save.connect(gui.CLICK, self.send, gui.CHANGE) table.tr() table.td(save, align=1) save_config = gui.Button('Save current configuration') save_config.connect(gui.CLICK, self.file_dialog_open, SAVE_CONFIG_EVENT) load_config = gui.Button('Load robot\'s configuration') load_config.connect(gui.CLICK, self.file_dialog_open, LOAD_CONFIG_EVENT) table.tr() table.td(save_config) table.tr() table.td(load_config) self.container.add(table, 0, 0) gui.Dialog.__init__(self, title, self.container)
def __init__(self, surface): self.surface = surface self.backgroundImage = pygame.image.load(g.dataPath + '/gui/menu_background.png') # character selection self.characters = [] self.charIndex = 1 self.charName = "" self.charLevel = 0 self.charClass = "WAAZZOR" self.charSprite = 1 # sprite image self.spriteScale = 3 self.spriteImage = pygame.Surface( (PIC_X * self.spriteScale, PIC_Y * self.spriteScale)) self.spriteImageRect = self.spriteImage.get_rect() self.spriteImageRect.centerx = 800 / 2 self.spriteImageRect.centery = 600 / 2 # GUI self.app = gui.App() self.charControl = characterControl() self.charControl.engine = self self.c = gui.Container(align=0, valign=0) self.c.add(self.charControl, 0, 0) self.app.init(self.c)
def loadFrame(): def open_file_browser(arg): d = gui.FileDialog('Load NoteMap file', path='records') d.connect(gui.CHANGE, handle_file_browser_closed, d) d.open() def handle_file_browser_closed(dlg): if dlg.value: input_file.value = dlg.value app.quit() app = gui.Desktop() main = gui.Container(width=500, height=400) # , background=(220, 220, 220) ) # main.add(gui.Label("File Dialog Example", cls="h1"), 20, 20) td_style = {'padding_right': 10} t = gui.Table() t.tr() t.td(gui.Label('File Name:'), style=td_style) input_file = gui.Input() t.td(input_file, style=td_style) b = gui.Button("Browse...") t.td(b, style=td_style) b.connect(gui.CLICK, open_file_browser, None) main.add(t, 20, 100) app.run(main) return input_file.value
def __init__(self, ctx, screen_width, screen_height, x, y, width, height): self._ctx = ctx self._solvers = ctx.solvers self._solver_label, self._solver_field = None, None self._solver_ui = None self._width = width self._height = height self._event_listeners = collections.defaultdict(list) self._outer_container = gui.Container(width=screen_width, height=screen_height, align=-1, valign=-1) # outer container where stuff goes self._main_container = gui.Table(width=width, height=height, hpadding=5, vpadding=5, align=-1, valign=-1) self._outer_container.add(self._main_container, x, y) self._build_ui() application = gui.App() application.init(self._outer_container) self._application = application
def __init__(self, **params): title = gui.Label("Settings") self.value = gui.Form() self.container = gui.Container() table = gui.Table() table.tr() self.sensors_img = gui.Image(p('icons/sensors.jpg')) table.td(self.sensors_img, cellspan=3) spacer = gui.Image(p('icons/choose_port.png')) self.box = gui.ScrollArea(spacer) table.tr() table.td(self.box, style={'border': 1}) table.tr() table.td(self.build_background_select(), style={ 'padding_top': 10, 'padding_bottom': 10 }) save = gui.Button('Save') save.connect(gui.CLICK, self.send, gui.CHANGE) table.tr() table.td(save, align=1) self.container.add(table, 0, 0) self.init_ports() gui.Dialog.__init__(self, title, self.container)
def __init__(self, bckg="None"): self.bckg = bckg title = gui.Label("Set background") self.value = gui.Form() self.container = gui.Container() table = gui.Table() table.tr() table.td(self.build_background_select(), style={ 'padding_top': 10, 'padding_bottom': 10 }) save = gui.Button('Save') save.connect(gui.CLICK, self.send, gui.CHANGE) table.tr() table.td(save, align=1) self.container.add(table, 0, 0) gui.Dialog.__init__(self, title, self.container)
def __init__(self, **params): title = gui.Label("Weibo Word Contrast") container = gui.Container(width=500, height=400) td_style = {'padding_right': 10} ################################# table = gui.Table(width=490, height=300) g = gui.Group() table.tr() table.td(gui.Label("Dlut", style=td_style, cls="h2")) check_box_1 = gui.Checkbox(g, value=1) check_box_1.connect(gui.CLICK, self.get_checked, 1) table.td(check_box_1) table.td(gui.Label("Tsinghua", style=td_style, cls="h2")) check_box_2 = gui.Checkbox(g, value=2) check_box_2.connect(gui.CLICK, self.get_checked, 2) table.td(check_box_2) table.td(gui.Label("Peking", style=td_style, cls="h2")) check_box_3 = gui.Checkbox(g, value=3) check_box_3.connect(gui.CLICK, self.get_checked, 3) table.td(check_box_3) table.tr() table.td(gui.Label("Naking", style=td_style, cls="h2")) check_box_4 = gui.Checkbox(g, value=4) check_box_4.connect(gui.CLICK, self.get_checked, 4) table.td(check_box_4) table.td(gui.Label("Ecupsl", style=td_style, cls="h2")) check_box_5 = gui.Checkbox(g, value=5) check_box_5.connect(gui.CLICK, self.get_checked, 5) table.td(check_box_5) ''' table.tr() table.td(gui.Label("With IDF", style=td_style, cls="h2")) check_box_6 = gui.Checkbox(g, value=6) check_box_6.connect(gui.CLICK, self.get_checked,6) table.td(check_box_6) table.td(gui.Label("Without IDF", style=td_style, cls="h2")) check_box_7 = gui.Checkbox(g, value=7) check_box_7.connect(gui.CLICK, self.get_checked,7) table.td(check_box_7) ''' table.tr() table.td(gui.Label("Show difference", style=td_style, cls="h2")) word_contrast_button = gui.Button("Click") word_contrast_button.connect(gui.CLICK, self.show_word_contrast, -1) table.td(word_contrast_button) table.td(gui.Label("clear", style=td_style, cls="h2")) check_box_7 = gui.Checkbox(g, value=0) check_box_7.connect(gui.CLICK, self.clear_value, 0) table.td(check_box_7) ################################# container.add(table, 1, 10) gui.Dialog.__init__(self, title, container)
def setup_sliders(self): table = gui.Table() table.tr() table.td(gui.Label('Двигатели:', font=self.font), align=-1) self.left_engine_slider = gui.VSlider(value=0, min=-100, max=100, size=10, width=16, height=200) self.right_engine_slider = gui.VSlider(value=0, min=-100, max=100, size=10, width=16, height=200) table.tr() container = gui.Container() table.td(container) left_input = gui.Input('0', font=self.font, size=4) right_input = gui.Input('0', font=self.font, size=4) def sliders_changed(): left_input.value = str(-self.left_engine_slider.value) right_input.value = str(-self.right_engine_slider.value) self.change_engine_power(-self.left_engine_slider.value, -self.right_engine_slider.value) def inputs_changed(): try: left = int(left_input.value) right = int(right_input.value) if abs(left) <= 100 and abs(right) <= 100: self.left_engine_slider.value = -left self.right_engine_slider.value = -right self.change_engine_power(left, right) except: pass self.left_engine_slider.connect(gui.CHANGE, sliders_changed) self.right_engine_slider.connect(gui.CHANGE, sliders_changed) left_input.connect(gui.KEYDOWN, inputs_changed) right_input.connect(gui.KEYDOWN, inputs_changed) lt = gui.Table(width=35) lt.tr() lt.td(left_input, align=1) gt = gui.Table() gt.tr() gt.td(right_input, align=-1) container.add(left_input, 20, 90) container.add(self.left_engine_slider, 70, 0) container.add(self.right_engine_slider, 120, 0) container.add(right_input, 140, 90) table.tr() table.td(gui.Spacer(height=20, width=0)) return table
def __init__(self, init_cb, save, load, set_ai_cb, font): self.app = gui.App() self.app.connect(gui.QUIT, self.app.quit, None) container = gui.Container(align=-1, valign=-1) self.font = font self.save_dlg = SaveDialog(save) self.load_dlg = LoadDialog(load) self.about_dlg = AboutDialog() self.dialogs = (self.save_dlg, self.load_dlg, self.about_dlg) menus = gui.Menus([ ('Game/New', init_cb, True), ('Game/Save', self.save_dlg.open, None), ('Game/Load', self.load_dlg.open, None), ('Game/Quit', self.quit, None), ('AI Level/Dumb', set_ai_cb, AI_Level.dumb), ('AI Level/Smart', set_ai_cb, AI_Level.smart), ('Help/About', self.about_dlg.open, None), ]) menus.rect.w, menus.rect.h = menus.resize() self.doc = gui.Document(width=0, height=0) # TODO: vertical? self.log_box = gui.ScrollArea(self.doc, SCREEN_WIDTH, 100, hscrollbar=False) self.log("Welcome to Battleships!") container.add(menus, 0, 0) container.add(self.log_box, 0, SCREEN_HEIGHT - 100) self.menus = menus self.elements = (menus, self.log_box) self.app.init(container)
def __init__(self, **params): gui.Desktop.__init__(self, **params) self.connect(gui.QUIT, self.quit, None) c = gui.Container(width=1000, height=600) self.fname = None self.open_d = gui.FileDialog() self.open_d.connect(gui.CHANGE, self.action_open, self.open_d) self.save_d = gui.FileDialog() self.save_d.connect(gui.CHANGE, self.action_save_close, self.save_d) menus = gui.Menus([('Archivo/Nuevo', self.action_new, None), ('Archivo/Abrir', self.open_d.open, None), ('Archivo/Guardar', self.action_save, self.fname), ('Archivo/Guardar como...', self.save_d.open, None), ('Archivo/Salir', self.quit, None)]) c.add(menus, 0, 0) menus.rect.w, menus.rect.h = menus.resize() change_b = gui.Button("Cambiar Fondo") change_b.connect(gui.CLICK, self.action_open_background, None) c.add(change_b, 0, 100) self.editor = Editor(width=800, height=600, style={'border': 1}) c.add(self.editor, 200, 0) self.editor.resize() self.widget = c
def file_treat(): global Window, Frame #TODO Agregar imagen a botones y estilo a fondo third_app = gui.Desktop(screen=Window, area=Frame) third_app.connect(gui.QUIT, third_app.quit, None) third_app.connect(gui.QUIT, app.quit, None) my_container3 = gui.Container(width=670, height=500) #Open button open_btn = gui.Button("Abrir") open_btn.connect(gui.CLICK, open_file_browser, True) #Save button save_btn = gui.Button("Guardar") save_btn.connect(gui.CLICK, open_file_browser, False) #Continue button / close file treatment ok_btn = gui.Button("Listo!") ok_btn.connect(gui.CLICK, third_app.quit, None) ok_btn.connect(gui.CLICK, app.quit, None) #Cancel button cancel_btn = gui.Button("Cancelar") cancel_btn.connect(gui.CLICK, third_app.quit, None) cancel_btn.connect(gui.CLICK, app.quit, None) #Add elements to container my_container3.add( gui.Image(const.imagespath + "Archivo_Background.png"), 0, 0) my_container3.add(open_btn, 155, 330) my_container3.add(save_btn, 455, 330) my_container3.add(ok_btn, 310, 375) my_container3.add(cancel_btn, 580, 10) third_app.run(my_container3) pygame.display.flip()
def __init__(self, **params): title = gui.Label("Weibo Dict Analysis") container = gui.Container(width=500, height=400) td_style = {"padding_right": 10} ############################ table = gui.Table(width=400, height=300) table.tr() table.td(gui.Label("Dlut", style=td_style, cls="h2")) dut_button = gui.Button("School") dut_button.connect(gui.CLICK, self.show_dict_result, 'dlut') table.td(dut_button, style=td_style) dut_person_button = gui.Button("Person") dut_person_button.connect(gui.CLICK, self.show_dict_person_result, 'dlut') table.td(dut_person_button, style=td_style) table.tr() table.td(gui.Label("Tsinghua", style=td_style, cls="h2")) Tsinghua_button = gui.Button("School") Tsinghua_button.connect(gui.CLICK, self.show_dict_result, 'tsinghua') table.td(Tsinghua_button, style=td_style) Tsinghua_person_button = gui.Button("Person") Tsinghua_person_button.connect(gui.CLICK, self.show_dict_person_result, 'tsinghua') table.td(Tsinghua_person_button, style=td_style) table.tr() table.td(gui.Label("Peking", style=td_style, cls="h2")) peking_button = gui.Button("School") peking_button.connect(gui.CLICK, self.show_dict_result, 'peking') table.td(peking_button, style=td_style) peking_person_button = gui.Button("Person") peking_person_button.connect(gui.CLICK, self.show_dict_person_result, 'peking') table.td(peking_person_button, style=td_style) table.tr() table.td(gui.Label("Nanking", style=td_style, cls="h2")) naking_button = gui.Button("School") naking_button.connect(gui.CLICK, self.show_dict_result, 'nanking') table.td(naking_button, style=td_style) naking_person_button = gui.Button("Person") naking_person_button.connect(gui.CLICK, self.show_dict_person_result, 'nanking') table.td(naking_person_button, style=td_style) table.tr() table.td(gui.Label("Ecupsl", style=td_style, cls="h2")) ecupsl_button = gui.Button("School") ecupsl_button.connect(gui.CLICK, self.show_dict_result, 'ecupsl') table.td(ecupsl_button, style=td_style) ecupsl_person_button = gui.Button("Person") ecupsl_person_button.connect(gui.CLICK, self.show_dict_person_result, 'ecupsl') table.td(ecupsl_person_button, style=td_style) ############################ container.add(table, 20, 30) gui.Dialog.__init__(self, title, container)
def __init__(self, init_code=None, init_text=None, ps1='>>>', **params): self._locals = {} self.commands = [] self.lastcmd = 0 title = gui.Label("Interactive console") self.container = gui.Container(background= (255, 255, 255)) t = gui.Table(width=env.w + env.WALL_HEIGHT*2 + 300 , height=85) t.tr() self.lines = gui.Table(background=(255, 255, 255)) self.box = gui.ScrollArea(self.lines, env.w + env.WALL_HEIGHT*2 + 300, 135, hscrollbar=False, vscrollbar=True, background=(255, 255, 255)) self.box.set_vertical_scroll(100) t.td(self.box) font = pygame.font.Font("theme/Inconsolata.ttf", 14) t.tr() it = gui.Table() it.td(gui.Label(' ' + ps1 + ' ', font=font)) dx = 1 if sys.platform.startswith('linux') else 0 self.line = gui.Input(size=(8*22 - len(ps1)*8 - dx), font=font) self.line.connect(gui.KEYDOWN, self.lkey) #self.line.connect(gui.MOUSEBUTTONDOWN, self.lkey) it.td(self.line) t.td(it) t.tr() t.td(Hack(1, 1, self.box)) self.container.add(t, 0, 0) if init_code is not None : code = compile(init_code, '<string>', 'single') eval(code,globals(),self._locals) if init_text is not None: _stdout = sys.stdout s = sys.stdout = StringStream(self.lines) val = self.line.value print(init_text) sys.stdout = _stdout self.ps1 = ps1 gui.Dialog.__init__(self, title, self.container)
def __init__(self): self.camera = Camera(self, None) self.gui = pgui.App(theme) self.gui_container = pgui.Container( width=value["init.virtual_width"], height=value["init.virtual_height"]) self.gui.init(self.gui_container)
def __init__(self, title, containerSize): self._container = gui.Container(width=containerSize.width, height=containerSize.height) # Cause we want sound pygame.mixer.init() self._click = pygame.mixer.Sound(strings.Audio.click) self._confirm = pygame.mixer.Sound(strings.Audio.confirm) super().__init__(gui.Label(title), self._container, namea=title)
def __init__(this, disp): gui.Desktop.__init__(this) # Setup the 'game' area where the action takes place # Setup the gui are a this.gameArea = gui.Container(height=disp.get_height() - INPUT_HEIGHT) this.menuArea = gui.Container(height=INPUT_HEIGHT) this.disp = disp this.maintb = gui.Table(height=500) this.maintb.tr() this.maintb.td(this.menuArea) this.maintb.tr() this.maintb.td(this.gameArea) this.setup_menu() this.init(this.maintb, this.disp)
def __init__(self, title): self.title = gui.Label(title) t = gui.Table() t.tr() self.line = gui.Input(size=49) self.line.connect(gui.KEYDOWN, self.lkey) t.td(self.line) main = gui.Container(width=20, height=20) # passing the 'height' parameter resulting in a typerror when paint was called gui.Dialog.__init__(self, self.title, t)
def __init__(self): # Box2D Initialization self.worldAABB = box2d.b2AABB() self.worldAABB.lowerBound = (-200.0, -100.0) self.worldAABB.upperBound = (200.0, 200.0) gravity = (0.0, -10.0) doSleep = True self.world = box2d.b2World(self.worldAABB, gravity, doSleep) self.destructionListener = fwDestructionListener() self.boundaryListener = fwBoundaryListener() self.contactListener = fwContactListener() self.debugDraw = fwDebugDraw() self.destructionListener.test = self self.boundaryListener.test = self self.contactListener.test = self self.world.SetDestructionListener(self.destructionListener) self.world.SetBoundaryListener(self.boundaryListener) self.world.SetContactListener(self.contactListener) self.world.SetDebugDraw(self.debugDraw) # Pygame Initialization if fwSettings.onlyInit: # testing mode doesn't initialize pygame return pygame.init() caption = "Python Box2D Testbed - " + self.name pygame.display.set_caption(caption) self.screen = pygame.display.set_mode((1000, 700)) self.debugDraw.surface = self.screen self.screenSize = box2d.b2Vec2(*self.screen.get_size()) try: self.font = pygame.font.Font(None, 24) except IOError: try: self.font = pygame.font.Font("freesansbold.ttf", 24) except IOError: print "Unable to load default font or 'freesansbold.ttf'" print "Disabling text drawing." self.DrawString = lambda x, y, z: 0 # GUI Initialization self.gui_app = gui.App() self.gui_table = fwGUI(self.settings) container = gui.Container(align=1, valign=-1) container.add(self.gui_table, 0, 0) self.gui_app.init(container) self.viewCenter = (0, 10.0 * 20.0)
def __init__(self, entity, width=320): self.widget = gui.Container(height=20, width=width, align=-1, valign=-1, cls="last") self.entity = entity self.width = width self.prev = PrevButton(self.entity, height=20, width=36) self.play = PlayButton(self.entity, height=20, width=36) self.next = NextButton(self.entity, height=20, width=36)
def __init__(self, title_txt, button_txt, allow_new, cls="dialog"): self.value = None self.save_folder = config.config.save_folder self.save_games = {} self._populate_save_games() if allow_new: self.name_input = gui.Input() else: self.name_input = None td_style = { 'padding_left': 4, 'padding_right': 4, 'padding_top': 2, 'padding_bottom': 2, } self.save_list = gui.List(width=350, height=250) games = self.save_games.keys() games.sort() for name in games: self.save_list.add(name, value=name) self.save_list.set_vertical_scroll(0) self.save_list.connect(gui.CHANGE, self._save_list_change) self.image_container = gui.Container() button_ok = gui.Button(button_txt) button_ok.connect(gui.CLICK, self._click_ok) button_cancel = gui.Button("Cancel") button_cancel.connect(gui.CLICK, self._click_cancel) body = gui.Table() body.tr() body.td(self.save_list, style=td_style, colspan=2) body.td(self.image_container, style=td_style, colspan=2) body.tr() if self.name_input: body.td(gui.Label("Save as:"), style=td_style, align=1) body.td(self.name_input, style=td_style) else: body.td(gui.Spacer(0, 0), style=td_style, colspan=2) body.td(button_ok, style=td_style, align=1) body.td(button_cancel, style=td_style, align=1) title = gui.Label(title_txt, cls=cls + ".title.label") gui.Dialog.__init__(self, title, body) if games: self.save_list.group.value = games[0]
def __init__(self, config): self.config = config self.running = True self.form = gui.Form() self.module = gui.Desktop() self.module.connect(gui.QUIT, self.module.quit, None) main = gui.Container(width=self.config['width'], height=self.config['height']) newdialog = NewKBDDialog(self.config) newdialog.connect(gui.CHANGE, self.module.quit, None) main.add(newdialog, 0, 0)
def __init__(self, surface): self.surface = surface self.x = 10 self.y = 10 self.backgroundImage = pygame.image.load(g.dataPath + '/gui/menu_background.png') # class selection self.classIndex = 0 # - statistics self.labelClassName = pygUI.pygLabel((350, 180, 100, 20), "CLASS NAME", align=pygUI.ALIGN_CENTER) self.labelInfoStats = pygUI.pygLabel((544, 50, 256, 20), "Class Statistics", align=pygUI.ALIGN_CENTER) self.labelHP = pygUI.pygLabel((544, 70, 10, 10), "HP: ") self.labelMP = pygUI.pygLabel((544, 90, 10, 10), "MP: ") self.labelSP = pygUI.pygLabel((544, 110, 10, 10), "SP: ") self.labelStr = pygUI.pygLabel((544, 150, 10, 10), "Strength: ") self.labelDef = pygUI.pygLabel((544, 170, 10, 10), "Defense:") self.labelSpd = pygUI.pygLabel((544, 190, 10, 10), "Speed:") self.labelMag = pygUI.pygLabel((544, 210, 10, 10), "Magic:") self.labels = (self.labelClassName, self.labelInfoStats, self.labelHP, self.labelMP, self.labelSP, self.labelStr, self.labelDef, self.labelSpd, self.labelMag) # sprite image self.spriteScale = 3 self.spriteImage = pygame.Surface( (PIC_X * self.spriteScale, PIC_Y * self.spriteScale)) self.spriteImageRect = self.spriteImage.get_rect() self.spriteImageRect.centerx = 800 / 2 self.spriteImageRect.centery = 600 / 2 # GUI self.app = gui.App() self.charControl = newCharControl() self.charControl.engine = self self.c = gui.Container(align=0, valign=0) self.c.add(self.charControl, 0, 0) self.app.init(self.c)
def __init__(self): pygame.init() # Used to manage how fast the screen updates self._clock = pygame.time.Clock() # Set the width and height of the screen [width, height] self._infoObject = pygame.display.Info() self._screen = pygame.display.set_mode( ((self._infoObject.current_w >> 1) + 300, (self._infoObject.current_h >> 1) + 300), pygame.HWSURFACE | pygame.DOUBLEBUF | pygame.RESIZABLE, 32) pygame.display.set_caption( "Kinect-based Gait Data Acquisition Software") # Loop until the user clicks the close button. self._done = False # Used to manage how fast the screen updates self._clock = pygame.time.Clock() # Kinect runtime object, we want only color and body frames self._kinect = PyKinectRuntime(PyKinectV2.FrameSourceTypes_Color | PyKinectV2.FrameSourceTypes_Body) # back buffer surface for getting Kinect color frames, 32bit color, width and height equal to the Kinect color frame size self._frame_surface = pygame.Surface( (self._kinect.color_frame_desc.Width, self._kinect.color_frame_desc.Height), 0, 32) # surface to draw skeleton self._skeleton_surface = pygame.Surface( (self._kinect.color_frame_desc.Width, self._kinect.color_frame_desc.Height), 0, 32) # here we will store skeleton data self._bodies = None self.app = gui.App() # app = gui.Desktop() self.skeletonCtrl = SkeletonControl() self.c = gui.Container(align=-1, valign=-1) self.c.add(self.skeletonCtrl, self._screen.get_width() // 2, self._frame_surface.get_height() // 2) # c.add(skeletonCtrl,300, 250) self.app.init(self.c)
def __init__(self,our_surface,width,height): self.SURFACE_W,self.SURFACE_H = our_surface.get_size() self.surface = our_surface self.app = gui.App() self.container = gui.Container(align=-1,valign=-1) self.button_list = [] self.button_width = width self.button_height = height self.separator = 5 self.finalized = False self.button_pressed = None self.title = "" self.titlecolour = [] self.titlesize = 0