def __init__(self, conffile): self.conf = read_yaml(conffile) self.col = Colours() self.req = {} self.req['headers'] = {'user-agent': self.conf['ua']} self.s_in = self.session_login() self.s_out = requests.Session()
def __init__(self, seed: int, log_filename: str): """ Initializes the game :param seed: :param log_filename: """ self.maps = [] self.default_entities = [] self.user_input = "" self.configurations = read_configuration_file() self.language = LanguageManagement(self.configurations.get("language_file")) self.options = OptionsMenu(self) mapname = get_level_file_name(self.language) self.read_units_dat() self.colours = Colours() self.player = self.set_entity("Player", -1, -1) self.maps.append(Map(mapname, self)) self.current_level = self.maps[0] self.rng = Random(seed) self.all_status_effects = status_effects.set_effect_values(status_effects.read_status_effects_dat(self)) self.brezelheim = Brezelheim(self.current_level) self.scr = Screen(self.configurations.get("screen_height"), self.configurations.get("screen_width")) self.msg_box = Messagebox(self.scr.len_x) self.keys = Input() # inits the input keys self.log_filename = log_filename self.log_file = None
def main(): do_tree, do_tess = get_args() c = Colours(background_alpha).complimentary() image = Image.new("RGBA", (imgx, imgy), choice(c)) draw = ImageDraw.Draw(image) if do_tess: f = Fortunes(imgx, imgy) for p in f.get_polygons(): draw.polygon(list(p.exterior.coords), fill=choice(c)) if do_tree: bright = True if brightness(c) > bright_threshold else False rbg_low, rbg_high = (bright_threshold, 255) if bright else (0, bright_threshold) FractalTree(imgx, imgy, draw).draw(imgx / 2, imgy, randint(-tilt_higher, -tilt_lower), branches=10, branch_width=20, colour=randomColour(rbg_low, rbg_high), bright=brightness(c) > bright_threshold) image.save("background.png", "PNG")
def __init__(self, setup, rules): self.array = None self.setup = None self.rules = None self.reset(setup=setup, rules=rules) self.team_colours = Colours(setup.teams) self.set_last_evolution_millis()
def __init__(self, conffile): urllib3.disable_warnings() self.conf = read_toml(conffile) self.col = Colours() self.req = {} self.req['headers'] = {'user-agent': self.conf['ua']} self.s_in = self.session_login() self.s_out = requests.Session()
def editColours(self, color=False): # if they've selected some items I'll create a palette of colours for them palette = [] if self.palette: for item in self.order.selectedItems(): palette.append(item.text()) for item in self.ignore.selectedItems(): palette.append(item.text()) dialr = Colours(section='Plot Colors', ini_file=self.config_file, add_colour=color, palette=palette, underscore=True) dialr.exec_() self.colours = {} config = configparser.RawConfigParser() config.read(self.config_file) try: colours = config.items('Plot Colors') for item, colour in colours: itm = item.replace('_', ' ') self.colours[itm] = colour except: pass for c in range(self.order.count()): col = self.order.item(c).text() try: self.order.item(c).setBackground( QtGui.QColor(self.colours[col.lower()])) except: pass for c in range(self.ignore.count()): col = self.ignore.item(c).text() try: self.ignore.item(c).setBackground( QtGui.QColor(self.colours[col.lower()])) except: pass
print(f"{error_text}\"screen_height\"") exit(-1) elif "screen_width" in line: try: configurations["screen_width"] = int(line.split("=")[1]) except ValueError or IndexError: print(f"{error_text}\"screen_width\"") exit(-1) elif "input_delay" in line: try: configurations["input_delay"] = float(line.split("=")[1]) except ValueError or IndexError: print(f"{error_text}\"input_delay\"") exit(-1) if len(configurations) < 4: print("config.txt is incomplete.") exit(-1) return configurations if __name__ == '__main__': record, replay, replay_filename, seed = interpret_parameters() if not replay: gtg = GateToGods(seed, replay_filename) gtg.play() else: colours = Colours() r = Replay(replay_filename, colours) r.play_replay(Input(), colours)