def __init__(self): self.cache = Cache(current_app, config={'CACHE_TYPE': 'simple'}) self.mongo = connect(current_app.config["MONGO_DB"]) self.mail = Mail(current_app) self.admin = Admin(current_app) self.rest_api = Api(current_app, prefix="/api") self.markdown = Markdown(current_app, safe_mode="escape") self.assets = assets(current_app)
def newEnemy(self, x): xInit = (random.randint(1, 20)) * 5 * -1 if x % 2 == 0: xInit = self.screen_width + (x + 1) * 5 e = enemy(pygame, xInit, self.screen_height - 102, 64, 64, 450, assets(pygame).getEnemy()) e.vel = random.randint(1, 4) * self.dificultyMultiplier return e
def __init__(self): pygame.init() pygame.display.set_caption('The Glorious Unnamed Game') self.screen_width = 900 self.screen_height = 500 self.fps = 60 self.clock = pygame.time.Clock() self.win = pygame.display.set_mode( (self.screen_width, self.screen_height)) self.level = pygame.Surface((self.screen_width, self.screen_height)) self.mainAssets = assets(pygame).mainAssets( (self.screen_width, self.screen_height)) self.level.blit(self.mainAssets.bgCloudBack, (0, 0)) self.level.blit(self.mainAssets.bgCloudFront, (0, 0)) self.level.blit(self.mainAssets.bgBack, (0, 0)) self.level.blit(self.mainAssets.bgFront, (0, 0)) self.ground = assets(pygame).getGroundBlock() self.dificultyMultiplier = 0.4 for x in range(0, self.screen_width, 48): self.level.blit(self.ground.img, (x, self.screen_height - self.ground.h)) self.font = pygame.font.Font("fonts/Abibas.ttf", 35) self.fontSmall = pygame.font.Font("fonts/Abibas.ttf", 25) self.textHealth = self.font.render("Health: ", True, (255, 255, 255)) self.textScore = self.fontSmall.render("Score: ", True, (255, 0, 0)) self.textDied = self.font.render("You Died", True, (255, 0, 0)) self.textNewGame = self.fontSmall.render( "Press ENTER to start a new game", True, (255, 255, 0)) self.man = player(pygame, (self.screen_width - (self.screen_width / 2) - 65), self.screen_height - 106, 64, 64, assets(pygame).getMan()) self.apple = apple(pygame, (self.screen_width - (self.screen_width / 2) - 32), self.screen_height - 70, 32, 32, assets(pygame).getApple()) self.enemies = []
def __init__(self, master=None): #ensure environment is set up and ready to go. self.a = assets() self.g = GPIO() self.l = light_ctrl() Frame.__init__(self, master) self.configure(background='#333',cursor='none') master.bind("<Button-1>",self.init_capture) master.bind("<Button-3>",self.quit_me) self.focus_set() self.pack() self.webcam=True self.capture=False self.createWidgets() self.populateWidgets()
def __init__(self, master=None): #ensure environment is set up and ready to go. self.a = assets() self.g = GPIO() self.l = light_ctrl() Frame.__init__(self, master) self.configure(background='#333', cursor='none') master.bind("<Button-1>", self.init_capture) master.bind("<Button-3>", self.quit_me) self.focus_set() self.pack() self.webcam = True self.capture = False self.createWidgets() self.populateWidgets()
import pygame, sys, assets from pygame.locals import * from decimal import ROUND_CEILING from random import random pygame.init() SCREEN = pygame.display.set_mode((116, 148)) pygame.display.set_caption('Tik Tak Toe') ASSETS = assets.assets() TURN = 'pc' MAP = ['', '', ''] for i in range(0, 3): MAP[i] = ['', '', ''] for j in range(0, 3): MAP[i][j] = '' def init(): 'Game init' ASSETS.init() def run(): while True: tick() render() def tick(): 'Game Update' if TURN == 'pc': xx = random(0, 2) // 1 yy = random(0, 2) // 1
#from lxml import etree import assets import nmap import os import pickle # start with blank document root if no document exists # read the network config file(s) cfgfile = "inbox/network1.config" n = assets.network() ip0 = None ip1 = None ns = [] dn = [] a = assets.assets() with open(cfgfile) as f: for line in f: if not line[0] == '#': s = line.strip().split(',') if s[0] == 'name': n.id = s[1] elif s[0] == 'site': a.id = s[1] elif s[0] == 'hosts': n.hosts = s[1] elif s[0] == 'ipstart': ip0 = s[1] elif s[0] == 'ipend': ip1 = s[1] elif s[0] == 'nameserver':