Пример #1
0
 def send_message(self, ip_addr, message):
     self.to_msg = text()
     self.to_msg.message = message
     self.to_msg.encrypt()
     self.to_msg.clear_text()
     temp_client = find_path()
     self.server.add_queue(temp_client, self.to_msg)
     self.to_msg = None
Пример #2
0
def createNewtext(self, wherex, wherey, screenCoordinates=1):
    self.fromClass = None
    self.toClass = None
    # try the global constraints...
    res = self.ASGroot.preCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    new_semantic_obj = text(self)
    ne = len(self.ASGroot.listNodes["text"])
    if new_semantic_obj.keyword_:
        new_semantic_obj.keyword_.setValue(
            new_semantic_obj.keyword_.toString() + str(ne))
    if screenCoordinates:
        new_obj = graph_text(self.UMLmodel.canvasx(wherex),
                             self.UMLmodel.canvasy(wherey), new_semantic_obj)
    else:  # already in canvas coordinates
        new_obj = graph_text(wherex, wherey, new_semantic_obj)
    new_obj.DrawObject(self.UMLmodel, self.editGGLabel)
    self.UMLmodel.addtag_withtag("text", new_obj.tag)
    new_semantic_obj.graphObject_ = new_obj
    self.ASGroot.addNode(new_semantic_obj)
    res = self.ASGroot.postCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    res = new_semantic_obj.postCondition(ASGNode.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    self.mode = self.IDLEMODE
    if self.editGGLabel:
        self.statusbar.event(StatusBar.TRANSFORMATION, StatusBar.CREATE)
    else:
        self.statusbar.event(StatusBar.MODEL, StatusBar.CREATE)
    return new_semantic_obj
Пример #3
0
def createNewtext(self, wherex, wherey, screenCoordinates = 1):
   self.fromClass = None
   self.toClass = None
   # try the global constraints...
   res = self.ASGroot.preCondition(ASG.CREATE)
   if res:
      self.constraintViolation(res)
      self.mode=self.IDLEMODE
      return

   new_semantic_obj = text(self)
   ne = len(self.ASGroot.listNodes["text"])
   if new_semantic_obj.keyword_:
      new_semantic_obj.keyword_.setValue(new_semantic_obj.keyword_.toString()+str(ne))
   if screenCoordinates:
      new_obj = graph_text(self.UMLmodel.canvasx(wherex), self.UMLmodel.canvasy(wherey), new_semantic_obj)
   else: # already in canvas coordinates
      new_obj = graph_text(wherex, wherey, new_semantic_obj)
   new_obj.DrawObject(self.UMLmodel, self.editGGLabel)
   self.UMLmodel.addtag_withtag("text", new_obj.tag)
   new_semantic_obj.graphObject_ = new_obj
   self.ASGroot.addNode(new_semantic_obj)
   res = self.ASGroot.postCondition(ASG.CREATE)
   if res:
      self.constraintViolation(res)
      self.mode=self.IDLEMODE
      return

   res = new_semantic_obj.postCondition(ASGNode.CREATE)
   if res:
      self.constraintViolation(res)
      self.mode=self.IDLEMODE
      return

   self.mode=self.IDLEMODE
   if self.editGGLabel :
      self.statusbar.event(StatusBar.TRANSFORMATION, StatusBar.CREATE)
   else:
      self.statusbar.event(StatusBar.MODEL, StatusBar.CREATE)
   return new_semantic_obj
Пример #4
0
blok6 = block(360, 360)
blok7 = block(400, 340)
blok8 = block(380, 340)
blok9 = block(360, 340)
#add blocks to list of blocks
blocks.extend((blok, blok2, blok3, blok4, blok5, blok6, blok7, blok8, blok9))
while (True):
    #for first iteration, set up game screen
    if begin:
        surface.fill(white)
        pygame.draw.line(surface, black, [0, 400], [500, 400], 1)
        for contents in blocks:
            contents.draw(surface)
        ba = ball(20, 392)
        ba.draw(surface)
        score = text("Score: " + str(points))
        score.draw(surface)
        begin = False
    surface.fill(white)
    pygame.draw.line(surface, black, [0, 400], [500, 400], 1)
    #loop through blocks list and draw them
    for contents in blocks:
        contents.draw(surface)
    for event in pygame.event.get():
        if (event.type
                == pygame.QUIT) or (event.type == pygame.KEYDOWN
                                    and event.__dict__['key'] == pygame.K_q):
            pygame.quit()
            exit()
        #user is only able to modify ball if it is in starting position
        if (ba.getLoc()[0] == 20 and ba.getLoc()[1] == 392):
Пример #5
0
                                   input_keys["move_leftward"],
                                   input_keys["move_rightward"]):
                    direction = event.key
                    move = True
            if event.type == KEYUP:
                move = False

        map_drawer(scr, "maps/map0.xml", x_pos, y_pos)
        scr.blit(actor.image, actor.rect)
        all_characters.draw(scr)

        if move:
            old_position = position
            result = calculation_position(direction, position)
            actor_image = result[0]
            position = result[1]
            x_pos = start_position[0] - position[0]
            y_pos = start_position[1] - position[1]
            if pygame.sprite.spritecollideany(actor, all_characters):
                bg_music("music/afterlife.mp3")
            actor.update(actor_image)
            all_characters.update(actor_image, position, old_position)
            text(scr, "Alice", "You're walking")
        else:
            text(scr, "Alice", "You've stopped")

    pygame.display.update()
    pygame.display.flip()

pygame.quit()
sys.exit()
Пример #6
0
def main():
    get_user_input()
    text()
    image()
Пример #7
0
                    width=15,
                    font=myfont,
                    anchor='center',
                    bg='#717171',
                    fg="white",
                    relief=FLAT).place(x=800, y=10)

bottomfr = Frame(root,
                 height=183,
                 width=1526,
                 highlightbackground="gray",
                 highlightthickness=0,
                 background='white').place(x=4, y=603)
labela = Label(bottomfr,
               text="Notifications",
               height=2,
               font=font.Font(family="Microsoft JhengHei UI Light", size=12),
               anchor='w',
               background='white',
               fg="#58111a").place(x=30, y=610)
listbo = Listbox(root,
                 width=95,
                 height=5,
                 font=font.Font(family="Microsoft JhengHei UI Light", size=10))
listbo.place(x=20, y=670)
noti(listbo)
##t = threading.Thread(target=noti, args=(listbo))
##t.start()

text()
Пример #8
0
        peluru_musuh_group.update()

    bom_group.update()
    peluru_laser_group.update()
    '''menggambar spirite group'''
    ship_group.draw(tampilan)
    peluru_group.draw(tampilan)
    musuh_group.draw(tampilan)
    peluru_musuh_group.draw(tampilan)
    bom_group.draw(tampilan)
    peluru_laser_group.draw(tampilan)
    text.draw_text()
    text.text_bos()
    '''Tombol atau keys '''
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    if countdown > 0:
        text('WARNING!!', text40, putih, int(panjang / 2 - 110),
             int(lebar / 2 + 10))
        count_timer = pygame.time.get_ticks()
        warning_fx.play()
        if count_timer - last_count > 1000:
            countdown -= 1
            last_count = count_timer

    pygame.display.update()
    FramePerSec.tick(FPS)

pygame.quit()