示例#1
0
    def __init__(self):

        self.CLOCK = pygame.time.Clock()
        self.FRECUENCY = 50
        self.ScreenSize = [800, 600]
        self.Screen = pygame.display.set_mode(self.ScreenSize,
                                              pygame.RESIZABLE)
        self.STATUS = GameStatus.PRESENTATION

        self.Finished = False
        self.Fullscreen = False
        self.Events = events.events()
        self.CurrentsAreas = []
        self.LastSize = [400, 400]
        pygame.display.set_caption("Tux world 3")
        status_cur.init()

        self.CurrentsAreas.append(test_level())

        while not self.Finished:
            self.Update()
            if (self.Events.get_keyboard()[pygame.K_RETURN]):
                while (not self.Events.get_keyboard()[pygame.K_SPACE]):
                    pygame.event.get()
                    self.Events.update_keyboard(pygame.key.get_pressed())
示例#2
0
 def __init__(self, config_file=None, layout_location=None, fonts_dir=None):
     ## @var log
     #  Handle to system logger
     self.log = logging.getLogger('system')
     ## @var pm
     #  Handle to pyplum instance
     self.pm = pyplum.pyplum()
     self.pm.register_parameter("log_level",
                                self.extra["module_name"],
                                value='debug',
                                store=True)
     self.pm.register_parameter("config_file",
                                self.extra["module_name"],
                                value=config_file)
     self.pm.register_parameter("layout_location",
                                self.extra["module_name"],
                                value=layout_location)
     self.pm.register_parameter("fonts_dir",
                                self.extra["module_name"],
                                value=fonts_dir)
     ## @var layout
     #  Handle to layout instance
     self.layout = layout.layout()
     ## @var events
     #  Handle to events instance
     self.log.debug("Initialising events", extra=self.extra)
     self.events = events.events()
示例#3
0
    def __init__(self, gameScreen):

        self.gameScreen = gameScreen
        # background color
        self.gameScreen.fill(black)

        self.clock = pygame.time.Clock()

        # Build the tile map, pass the game screen to the map
        self.gamemap = TileMap.Tilemap(self.gameScreen)

        # The dictionary containing the ghosts in the map, key: ghost's color, value: ghost object
        self.ghostdict = dict()
        # Red, Blue, Pink and Orange ghosts
        self.ghostdict['R'] = ghosts.Ghost('R', self.gameScreen, self.gamemap)
        self.ghostdict['B'] = ghosts.Ghost('B', self.gameScreen, self.gamemap)
        self.ghostdict['P'] = ghosts.Ghost('P', self.gameScreen, self.gamemap)
        self.ghostdict['O'] = ghosts.Ghost('O', self.gameScreen, self.gamemap)

        self.PacMan = pacman.PacMan(PacManImg, gameScreen)

        self.events = events.events()
        self.fruits = events.fruits()
        self.frightenedtime = None

        # Game start time
        self.game_start_time = pygame.time.get_ticks()
示例#4
0
    def main_map(self, screen, player, assets):
        escape_call = Escape()
        sector_map = IconTree(self.images)
        sector_map.update()
        player_loc = sector_map.root
        alive = True
        win = None
        while alive and win is None:
            screen.blit(self.bg, (0, 0))
            screen.blit(self.legend, (580, 20))
            screen.blit(self.up, self.up_rect)
            screen.blit(self.down, self.down_rect)

            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
                    break

                elif event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        escape_call.escape_menu(screen)
                        break
                elif event.type == MOUSEBUTTONDOWN:
                    position = pygame.mouse.get_pos()
                    if self.up_rect.collidepoint(
                            position) or self.down_rect.collidepoint(position):
                        sector_map.scroll(screen, player_loc, self.bg,
                                          self.legend, self.up, self.down,
                                          self.up_rect, self.down_rect)
                    for sp in sector_map.sprites():
                        if sp.is_child(player_loc) and sp.collide(position):
                            player_loc = sp
                            if sp.type == 'minion':
                                alive = battle(screen, player, assets,
                                               escape_call)
                            elif sp.type == 'boss':
                                win = battle(screen,
                                             player,
                                             assets,
                                             escape_call,
                                             boss=True)
                            elif sp.type == 'unknown':
                                alive = events(screen, player, assets,
                                               escape_call)
                            elif sp.type == 'repair':
                                repair(screen, player, assets, escape_call)
                            elif sp.type == 'shop':
                                shop(screen, player, assets, escape_call)
                if alive:
                    sector_map.draw(screen, player_loc)
                    pygame.display.update()
            if player.current_health <= 0:
                break
        if not win or player.current_health <= 0:
            game_over(screen)
        if (win):
            game_win(screen)
示例#5
0
 def quit(self):
     pm = pyplum.pyplum()
     # Stop pyplum
     pm.parameters['quit']['value'] = True
     # Stop events
     if pm.event_queue is not None:
         pm.event_queue.put(('quit', ))
     events_instance = events.events()
     events_instance.stop()
示例#6
0
    def __init__(self, WIDTH, HEIGHT):

        print "iosys started"
        #CLOCK
        self.CLOCK = pygame.time.Clock()
        #OUTPUT
        self.SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))
        pygame.display.set_caption("Pong multiplayer client")
        #INPUT
        self.EVENTS = events()
        #LOGIC
        self.STAGE = stage()

        self.on = True
        self.fullscreen = False
示例#7
0
    def __init__(self, WIDTH, HEIGHT):
        from stage import stage
        print "iosys started"
        #CLOCK
        self.CLOCK = pygame.time.Clock()
        #OUTPUT
        self.SCREEN = pygame.display.set_mode(
            (WIDTH, HEIGHT), HWSURFACE | DOUBLEBUF | RESIZABLE)
        pygame.display.set_caption("Tux world")
        #INPUT
        self.EVENTS = events()
        #LOGIC
        self.STAGE = stage()

        self.on = True
        self.fullscreen = False
示例#8
0
class Clasic:
    EVENTS = events.events()

    def __init__(self):
        self.EVENTS = None
        self.x, self.y = 0, 0
        self.W, self.H = 0, 0

        self.cursorChange = False

    def SetCursorChange(self):
        self.cursorChange = True

    def SetEvents(self, EVENTS):
        self.EVENTS = EVENTS

    def UpdateSurface(self, surface):
        self.W, self.H = surface.get_size()
        self.surface = surface

    def Focused(self):  #Marcado por el mouse
        MOUSE = self.EVENTS.get_mouse()

        MOUSE_X = MOUSE.get_position()[0]
        MOUSE_Y = MOUSE.get_position()[1]

        if (MOUSE_X > self.x and MOUSE_X < self.x + self.W):
            if (MOUSE_Y > self.y and MOUSE_Y < self.y + self.H):
                try:
                    h = self.cursorChange
                except:
                    self.cursorChange = False
                if (self.cursorChange):
                    status_cur.set_pointer()
                return True
        return False

    def Pressed(self, click=0):  #Presionado
        PRESSED = self.EVENTS.get_mouse().get_pressed()[click]

        return PRESSED and self.Focused()
示例#9
0
def not_outside():
    message = random.choice([
        "That's too bad.", "That's okay, we all have days like that.",
        "I'm sorry. ", "That's not good.", "It's okay."
    ])

    session.attributes["Outside"] = "No"
    session.attributes["State"] = "Suggested"
    response = evaluate_answers()
    count = callLvl2()
    suggestion_inquiry = "Let's also try something else to improve your mood."
    idea = ideas()
    if idea == "Try some events near you.":
        event = events.events()
        return question(message + "      " + response + "       " +
                        suggestion_inquiry + "       " + idea + "       " +
                        event + "        " + "would be a good start.")
    else:
        return question(
            message + "      " + response + "       " + suggestion_inquiry +
            "       " + idea + "          " +
            "I hope I could help.  Would you like another suggestion?")
示例#10
0
文件: db.py 项目: AshinGau/eventdb
 def genInfo(self, dirPath):
     tableName = self.tableName
     for walker in os.walk(dirPath):
         root, dir, files = walker
         if files:
             fileCount = len(files)
             eventCount = 0
             runID = ''
             for file in files:
                 cf = os.path.join(root, file)
                 with events(cf) as evts:
                     eventCount += evts.getEntries()
                     runID = evts.getRunNo()
             print 'Finished to analyze run: %s' % runID
             self.table.counter_inc('totalEvents', 'data:value', eventCount)
             self.table.put(
                 tableName + '#' + runID, {
                     'data:runID': runID,
                     'data:tableName': tableName,
                     'data:fileCount': str(fileCount),
                     'data:eventCount': str(eventCount)
                 })
     self.resetRowCount()
示例#11
0
    def __init__(self):
        self.CLOCK      = pygame.time.Clock()
        self.FRECUENCY  = 40
        self.ScreenSize = [800,600]
        self.Screen     = pygame.display.set_mode(self.ScreenSize,pygame.RESIZABLE)
        self.STATUS     = GameStatus.PRESENTATION


        self.Finished      = False
        self.Fullscreen    = False
        self.Events        = events.events()
        self.CurrentsAreas = []
        self.LastSize      = [0,0]
        pygame.display     . set_caption("Tux world 3")
        status_cur         . init()
        
        presentationA = presentation.Presentation()
        self.CurrentsAreas.append(presentationA)
        
        self.PRESENTATION = presentationA
        
        while not self.Finished:
            self.Update()
示例#12
0
#Since it's going to be used a ton, short name gv for global variable access
#TODO add in config.ini class to fill in globalvars

gv = globalvars.globalvars(size, framerate)

gv.version = u"Deluge 0.2 | Perineum."

#should toss time in a class eventually
gv.Clock = pygame.time.Clock()
gv.Clock.tick()

displayinstance = display.display(gv)
#playfieldinstance = playfield.playfield(gv, displayinstance)
consoleinstance = console.console(gv, displayinstance)
eventsinstance = events.events(gv, displayinstance, consoleinstance)
gameinstance = deluge.deluge(gv, displayinstance)
gameinstance.initBoard()

while 1:

    eventsinstance.handleevents()
    displayinstance.begin()

    #---- deluge
    #playfieldinstance.drawplayfield()
    gameinstance.checkEvents()
    gameinstance.drawBoard()

    #----
示例#13
0
#Since it's going to be used a ton, short name gv for global variable access
#TODO add in config.ini class to fill in globalvars


gv = globalvars.globalvars(size, framerate)

gv.version = "Flippy Pad 0.3"

#should toss time in a class eventually
gv.Clock = pygame.time.Clock()
gv.Clock.tick()


displayinstance = display.display(gv)
consoleinstance = console.console(gv)
eventsinstance = events.events(gv)
flippy = flippy_pad.flippy(gv)



#gv.console.log("MAIN: TEST LOG ENTRY - WEE!")


while 1:
    
    eventsinstance.handleEvents()
    flippy.update()

    consoleinstance.begin()
    
    displayinstance.paint()
示例#14
0
    def __init__(self):
        EVENTS = events.events()
        self.__x, self.__y = 0, 0
        self.__W, self.__H = 0, 0

        self.cursorChange = False
示例#15
0
 def test_saltar(self):
     tecla = "barra_espaciadora"
     presionar = "si"
     output = events.events(tecla, presionar)
     self.assertEqual(output, "saltar", "Error al saltar")
示例#16
0
 def test_pausa(self):
     tecla = "p"
     presionar = "si"
     output = events.events(tecla, presionar)
     self.assertEqual(output, "juego pausado", "Error al pausar juego")
示例#17
0
from datetime import datetime

print("called")

print("input format DD MM YYYY      HH MM")
event_name = input('event name         : ')
start_date = input('starting date (leave empty for today) : ')
start_time = input('starting time : ')
end_date = input('ending date (leave empty for today)   : ')
end_time = input('ending time : ')

if (start_date == ''):
    start_date = str(datetime.now().date())
else:
    start_date = start_date[6:10] + "-" + start_date[3:5] + "-" + start_date[
        0:2]

if (end_date == ''):
    end_date = str(datetime.now().date())
else:
    end_date = end_date[6:10] + "-" + end_date[3:5] + "-" + end_date[0:2]

st = start_date + "T" + start_time[0:2] + ":" + start_time[3:5] + ":00"
et = end_date + "T" + end_time[0:2] + ":" + end_time[3:5] + ":00"

event = events(event_name, st, et, 'ad', 'df').event
print(event)
gcalanderapi().create_event(event)

print("done")
示例#18
0
def getEvents():
    return events()
示例#19
0
def handle_no():
    try:
        if session.attributes["State"] == "Question 0 Answered":
            return statement("Okay. Check in with me again later!")
        elif session.attributes["State"] == "Question 1 Answered":
            message = random.choice([
                "That's too bad.", "That's okay, we all have days like that.",
                "I'm sorry. ", "That's too bad", "It's okay."
            ])

            session.attributes["State"] = "Question 2 Answered"
            session.attributes["Bed"] = "No"
            return question(message + "            " + "Have you eaten today?")
        elif session.attributes["State"] == "Question 2 Answered":
            message = random.choice([
                "That's too bad.", "That's okay, we all have days like that.",
                "I'm sorry. ", "That's not good.", "It's okay."
            ])

            session.attributes["Eaten"] = "No"
            session.attributes["State"] = "Question 3 Answered"
            return question(message + "            " +
                            "Have you showered today?")
        elif session.attributes["State"] == "Question 3 Answered":
            message = random.choice([
                "That's too bad.", "That's okay, we all have days like that.",
                "I'm sorry. ", "That's not good.", "It's okay."
            ])

            session.attributes["Showered"] = "No"
            session.attributes["State"] = "Question 4 Answered"
            return question(message + "            " +
                            "Have you gotten dressed?")
        elif session.attributes["State"] == "Question 4 Answered":
            message = random.choice([
                "That's too bad.", "That's okay, we all have days like that.",
                "I'm sorry. ", "That's not good.", "It's okay."
            ])

            session.attributes["Dressed"] = "No"
            session.attributes["State"] = "Question 5 Answered"
            return question(message + "         " +
                            "Have you gone outside at all today?")
        elif session.attributes["State"] == "Question 5 Answered":
            message = random.choice([
                "That's too bad.", "That's okay, we all have days like that.",
                "I'm sorry. ", "That's not good.", "It's okay."
            ])

            session.attributes["Outside"] = "No"
            count = callLvl2()
            session.attributes["State"] = "Suggested"
            response = evaluate_answers()
            suggestion_inquiry = "Let's also try something else to improve your mood."
            idea = ideas()
            if idea == "Try some events near you.":
                event = events.events()
                return question(message + "      " + response + "       " +
                                suggestion_inquiry + "       " + idea +
                                "       " + event + "        " +
                                "would be a good start.")
            else:
                return question(message + "      " + response + "       " +
                                suggestion_inquiry + "       " + idea +
                                "          " +
                                "I hope I could help. Anything else I can do?")
        elif session.attributes["State"] == "Suggested":
            session.attributes["State"] = "AnythingElse"
            return question(
                "Okay, I hope that helped. Anything else I can do for you?")
        elif session.attributes["State"] == "AnythingElse":
            return statement("No problem. Check in with me later. Goodbye")
        else:
            return question(
                "I'm sorry, I didn't get that. How are you feeling? ")
    except:
        return question("I'm sorry, I didn't get that. How are you feeling?")
示例#20
0
文件: main.py 项目: zsouthboy/Deluge
#Since it's going to be used a ton, short name gv for global variable access
#TODO add in config.ini class to fill in globalvars


gv = globalvars.globalvars(size, framerate)

gv.version = u"Deluge 0.2 | Perineum."

#should toss time in a class eventually
gv.Clock = pygame.time.Clock()
gv.Clock.tick()

displayinstance = display.display(gv)
#playfieldinstance = playfield.playfield(gv, displayinstance)
consoleinstance = console.console(gv, displayinstance)
eventsinstance = events.events(gv, displayinstance, consoleinstance)
gameinstance = deluge.deluge(gv, displayinstance)
gameinstance.initBoard()


while 1:
    
    eventsinstance.handleevents()
    displayinstance.begin()

    #---- deluge
    #playfieldinstance.drawplayfield()
    gameinstance.checkEvents()
    gameinstance.drawBoard()
    
    
pygame.key.set_repeat(300, 30)
screen = pygame.display.set_mode((1920, 1080))
inMenu = True
screen.fill((255, 255, 255))
clock = pygame.time.Clock()
flagUnavail = 0
flagInvalidPrice = 0
flagInvalidAmount = 0
screen.fill((255, 255, 255))
rect = pygame.Rect((0, 0, 50, 50))
rect.center = screen.get_rect().center
clock = pygame.time.Clock()
red = (255, 0, 0)
score = 0
startShopping = 1
customer = events()
pygame.display.flip()
white = (255, 255, 255)
# declaration of some ThorPy elements ...
money = money(5000)
supplierUpdate = 1
storeUpdate = 1

shopSuccess = 0
shopFail = 0
supplierCollisionList = pygame.sprite.Group()
customerCollisionList1 = pygame.sprite.Group()
customerCollisionList2 = pygame.sprite.Group()
menuCollisionList = pygame.sprite.Group()
storeCollisionList = list()
# we regroup all elements on a menu, even if we do not launch the menu
示例#22
0
import argparse, os, sys, random, creds, emoji
from pycam import capture_plant
from events import events
from datetime import date
from caption_maker import weather_caption, feeling
from instabot import Bot

plant_emojis = [":four_leaf_clover:", ":deciduous_tree:", ":herb:", ":cactus:", ":seedling:", ":evergreen_tree:"]

sys.path.append(os.path.join(sys.path[0], "../"))

event_text = str(f"{events()}\n") if events != "" else event_text = events()

caption = f"{date.today()}  {emoji.emojize(random.choice(plant_emojis))}\n{event_text}{weather_caption()}°C i am {feeling()}!\n\n\n\n#plants #nature #bot"

bot = Bot()
bot.login(username=creds.u, password=creds.p)
capture_plant()
bot.upload_photo("image.jpg", caption)

print(caption)
示例#23
0
 def test_salir_juego(self):
     tecla = "q"
     presionar = "si"
     output = events.events(tecla, presionar)
     self.assertEqual(output, "salir de", "Error al salir del juego")