Advertisement
Guest User

Untitled

a guest
Nov 8th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. from classes.class_program import logic
  2. import pygame
  3. from pygame.locals import *
  4. import sys
  5. import time
  6.  
  7. logic = logic()
  8.  
  9. pygame.init()
  10.  
  11. main_window = pygame.display.set_mode((300,600))
  12. pygame.display.set_caption('Xbox Alert')
  13.  
  14. font_object = pygame.font.SysFont('Times New Roman', 32)
  15. msg = 'gamertag here'
  16.  
  17. connected = []
  18. running = True
  19. while running == True:
  20.     main_window.fill((0,0,0))
  21.  
  22.     for event in pygame.event.get():
  23.         if event.type == pygame.QUIT:
  24.             running = False
  25.             pygame.quit()
  26.     try:
  27.         checker = logic.online_check()
  28.         if checker == True:
  29.             connected.append(True)
  30.         else:
  31.             connected.append(False)
  32.         print connected
  33.         alert = logic.online_alert(connected)
  34.         if connected[-1] == True:
  35.             connect_color = (0, 255, 0)
  36.         else:
  37.             connect_color = (255, 0, 0)
  38.     except:
  39.         connect_color = (255, 0, 0)
  40.         continue
  41.     msg_surface_object = font_object.render(msg, False, connect_color)
  42.     msg_rect_object = msg_surface_object.get_rect()
  43.     msg_rect_object.topleft = (10,20)
  44.     main_window.blit(msg_surface_object, msg_rect_object)
  45.  
  46.     pygame.display.update()
  47.     time.sleep(20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement