def __init__(self, parent=None, tab_title='Batch.io', isStatic=False): super(AssetListWidget, self).__init__(parent) self.setGeometry(0, 0, 240, 0) self.assetWidgets = {} self.tab_dict = {} self.isDroppable = True self.titleLbl = QLabel(tab_title) self.tab_title = tab_title self.animWaitingColor = False self.log = None self.colors = Colors() self.isStatic = isStatic self.initUI()
def _setup(self, host, task): """ Implementation specific setup for outputting to the CLI. :Parameters: - `host`: name of the host - `task`: name of the task """ import Colors import sys self._c = Colors.Colors() self._sys = sys self._sys.stdout.write('%s:\n' % (self._c.format_string(host, 'blue'))) self._sys.stdout.write( '%s Starting Task[%s]\n' % (self.timestamp, self._c.format_string(task, 'white')))
def __init__(self, parent=None): super(AssetWidget, self).__init__(parent) self.isDraggable = False self.isDroppable = False self.isAssetWidget = True self.isTrigger = False self.isHeader = False self.asset_width = 210 self.asset_height = 50 self.button_size = self.asset_height / 2 self.hasProgressBar = False self.hasContextMenu = False self.isInterative = True self.colors = Colors() self.asset_btn_list = [] self.type = None self.initUI()
def __init__(self): super(Background, self).__init__( (getGameDimension()[0], getGameDimension()[1])) # the rect is the score table of this game pygame.draw.rect(self, Colors().FloralWhite, (0, 0, getGameDimension()[2], getGameDimension()[3])) backgroundImg = pygame.image.load( './assets/images/field/soccer-field.png') backgroundImg2 = pygame.image.load( './assets/images/background/WechatIMG174.png') backgroundImg3 = pygame.image.load( './assets/images/background/WechatIMG173.png') resizedbackgroundImg2 = pygame.transform.scale(backgroundImg2, (1100, 60)) resizedbackgroundImg3 = pygame.transform.scale(backgroundImg3, (300, 60)) self.blit(backgroundImg, (0, getGameDimension()[3])) self.blit(resizedbackgroundImg2, (0, 0)) self.blit(resizedbackgroundImg3, (800, 0))
red_entry.text = str(current_color[0]) green_entry.text = str(current_color[1]) blue_entry.text = str(current_color[2]) except: speed_entry.text = str(rate_of_change) red_entry.text = str(current_color[0]) green_entry.text = str(current_color[1]) blue_entry.text = str(current_color[2]) # global_variables------------------------------------------------------------------------------------------------------ WIN_WIDTH = 0 WIN_HEIGHT = 0 FPS = 120 current_color = Colors().absolute_random_color() render_color = current_color rate_of_change = 1.0 # draw_menu------------------------------------------------------------------------------------------------------------- pygame.init() screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT), pygame.FULLSCREEN) pygame.display.set_caption('GUI_test') clock = pygame.time.Clock() title = Label(screen, text='GUI test', font_size=100, fg=Colors().black) speed_label = Label(screen, text='Speed:', font_size=50, fg=Colors().black) speed_entry = Entry(screen, width=200, height=50,
def action(arg): print 'action()' # init soya in resizable window: soya.init('Canta', 1024, 768, 0) # working dir: APP_DIR = os.path.join('..', os.curdir) # fonts: font = soya.Font( os.path.join(APP_DIR, 'data', 'fonts', 'DejaVuSansCondensed.ttf'), 16, 12) # global colors: colors = Colors.Colors(debug=DEBUG) # set soya's style path: style = Style.Style(APP_DIR, font, colors, DEBUG) # initialize pudding: pudding.init(style=style) # set the root scene: scene = soya.World() # create the pudding root widget: widget = pudding.core.RootWidget(width=1024, height=768) # a test filter: test_filter = .50
def AlterBlueColor(): global blue if btnBluePlus.getPressedButton(50, 540, 50, 50) and blue < 255: blue += alter if btnBlueMinus.getPressedButton(1200, 540, 50, 50) and blue > 1: blue -= alter def AlterAllColors(): AlterRedColor() AlterGreenColor() AlterBlueColor() #Objects events = Event.Events() colors = Colors.Colors() keyboard = Keyboard.KeyBoard() draw = Draw.Draw() text = Text.Text() btnPlus = Button.Button() btnMinus = Button.Button() btnPlusWidth = Button.Button() btnPlusHeight = Button.Button() btnMinusWidth = Button.Button() btnMinusHeight = Button.Button() btnRedPlus = Button.Button() btnRedMinus = Button.Button() btnBluePlus = Button.Button()
def read_color(): """Convert colors sensor output into members of the Colors Enum""" return Colors(_RIGHT.value() + 1)
def __init__(self): self.picker = [] self.choice = [] pygame.init() self.begin = True while self.begin: self.front = Start.Start() if self.front.choice(): self.x = WIDTH / 2 self.y = HEIGHT - 140 self.score = 0 self.box1 = Colors.Colors(50, 20) self.box2 = Colors.Colors(180, 20) self.box3 = Colors.Colors(310, 20) self.box4 = Colors.Colors(440, 20) self.box5 = Colors.Colors(50, 150) self.box6 = Colors.Colors(180, 150) self.box7 = Colors.Colors(310, 150) self.box8 = Colors.Colors(440, 150) self.box9 = Colors.Colors(50, 280) self.box10 = Colors.Colors(180, 280) self.box11 = Colors.Colors(310, 280) self.box12 = Colors.Colors(440, 280) self.box13 = Colors.Colors(50, 410) self.box14 = Colors.Colors(180, 410) self.box15 = Colors.Colors(310, 410) self.box16 = Colors.Colors(440, 410) self.box = [self.box1,self.box2,self.box3,self.box4, \ self.box5,self.box6,self.box7,self.box8, \ self.box9,self.box10,self.box11,self.box12, \ self.box13,self.box14,self.box15,self.box16] self.image = pygame.image.load('app.png').convert_alpha() self.image = pygame.transform.scale(self.image, (100, 100)) self.spritebox = pygame.sprite.Group(self.box) self.display = pygame.display.set_mode((WIDTH, HEIGHT)) self.background = pygame.Surface( self.display.get_size()).convert() for i in self.box: self.background.blit(self.image, (i.x, i.y)) self.font = pygame.font.SysFont('bodoniblack', 50) self.font2 = pygame.font.SysFont('bodoniblack', 20) self.value = self.font.render('Score: ' + str(self.score), True, (0, 0, 255)) self.text = self.font2.render('Click the images', True, (255, 0, 255)) self.text2 = self.font2.render('in the order that', True, (255, 0, 255)) self.text3 = self.font2.render('they change', True, (255, 0, 255)) self.background.blit(self.text, (350, 550)) self.background.blit(self.text2, (350, 580)) self.background.blit(self.text3, (350, 610)) self.num = 4 self.game = True while self.game: for i in range(len(self.picker)): self.picker[i].revert() self.picker = [] self.choice = [] self.game = Controller.game(self) self.num += 1 self.end = End.End(self.score) self.begin = self.end.choice() else: self.begin = False pygame.quit()
CHANNEL = 0 Board_Type = ws.SK6812_STRIP_RGBW #-------Convert-To-Object-----------------------------------# ring = Adafruit_NeoPixel( COUNT,PIN,FREQUENCY,DMA,INVERT,BRIGHTNESS,CHANNEL,Board_Type) ring.begin() # setup for the IO #--------Rotary-Encoder-------------------------------------# CLK_PIN = 2 DT_PIN = 3 SW_PIN = 4 #-----------Rotory-Encoder-OBJ------------------------------# k = Knob(CLK_PIN,DT_PIN,SW_PIN) start(k) # setup for IO and interupts #-----------------------------------------------------------# pled = Colors(ring.numPixels(),'Red') try: print('Ready') colorlist(ring,pled.now) n = range(ring.numPixels()) current = 0 while not pled.iswin(): Knob.rot = 0 Knob.click = 0 c_blink(ring,n[current],1,.1) if Knob.click == 1: